gen-libllama-abi: compile sort-key regex once outside the lambda

Agent-Logs-Url: https://github.com/ggml-org/llama.cpp/sessions/cd21903e-afd2-477a-8285-0a2d46e1398c

Co-authored-by: ggerganov <1991296+ggerganov@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-15 12:04:44 +00:00 committed by GitHub
parent 51b679a5d6
commit 4943e3a396
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -152,7 +152,13 @@ def extract_signatures(header_text: str) -> list[str]:
if sig and '(' in sig:
sigs.append(sig)
sigs.sort(key=lambda s: re.search(r'\b(llama_\w+)\s*\(', s).group(1) if re.search(r'\b(llama_\w+)\s*\(', s) else s)
_name_re = re.compile(r'\b(llama_\w+)\s*\(')
def _sort_key(s: str) -> str:
m = _name_re.search(s)
return m.group(1) if m else s
sigs.sort(key=_sort_key)
return sigs