Files
CLIProxyAPI/internal/thinking
JohnsonRan 6b56ce6c28 perf(thinking): skip document copies when deleting absent fields
sjson.DeleteBytes copies the whole document even when the path is
missing: appendRawPaths builds a prefix copy that is discarded, then
set() copies the input again before SetBytes returns the original
slice. The summary config and the Gemini/Antigravity level and budget
appliers defensively delete several alias spellings that are almost
always absent, so each request paid several full-body copies.

Add util.DeleteJSONBytesIfExists, which checks the path with
GetGJSONBytesNoCopy first, and use it at those call sites. Output is
unchanged.

On a 1 MiB Antigravity body, applySummaryConfigForProvider drops from
7.4 MB to 1.1 MB allocated per call. In a production heap profile these
deletes were 35 GB of 192 GB allocated over 72 minutes.
2026-10-25 03:42:05 +09:00
..