Files
CLIProxyAPI/internal/runtime/executor/helps/response_decode.go
JohnsonRan 3c948a5808 perf(executor): decode upstream zstd synchronously and sniff unlabeled bodies lazily
DecodeResponseBody used zstd.NewReader with its default options, which
hands blocks to up to four asynchronous decoders: allocations and handoff
latency on every streamed response for no gain on bodies read as they
arrive. Decode with WithDecoderConcurrency(1) instead.

A response without Content-Encoding was sniffed for gzip/zstd magic with
Peek(4) before DecodeResponseBody returned, blocking the caller until the
upstream sent its first bytes. Detect on the first Read instead, waiting
for more than one byte only when the first byte can start a gzip or zstd
frame.
2026-10-27 04:18:42 +09:00

6.7 KiB