From 03ea4e569fb1df9237d7032469a744737cd30d72 Mon Sep 17 00:00:00 2001 From: edlsh Date: Sat, 18 Apr 2026 12:49:02 -0400 Subject: [PATCH] perf(claude): pre-allocate reverseMap capacity Address Gemini code review suggestion: the reverseMap can contain at most len(oauthToolRenameMap) entries, so pre-allocating avoids reallocations as entries are added. --- internal/runtime/executor/claude_executor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/runtime/executor/claude_executor.go b/internal/runtime/executor/claude_executor.go index 7f00ac08b..78fa3cd6f 100644 --- a/internal/runtime/executor/claude_executor.go +++ b/internal/runtime/executor/claude_executor.go @@ -1018,7 +1018,7 @@ func isClaudeOAuthToken(apiKey string) bool { // Amp's `glob`→`Glob`), because the global reverse map contained `Bash`→`bash` // regardless of what the client originally sent. func remapOAuthToolNames(body []byte) ([]byte, map[string]string) { - reverseMap := make(map[string]string) + reverseMap := make(map[string]string, len(oauthToolRenameMap)) recordRename := func(original, renamed string) { // Preserve the first-seen original name if the same upstream name is // produced from multiple call sites; they all map back identically.