Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 11, 07:15 UTC
reverseproxy: reduce allocation/CPU overhead in request hot paths (#7925)
Build the Via request and response headers with strconv-based concatenation instead of fmt.Sprintf, avoiding fmt's reflection and formatting overhead on every proxied request/response. Same single allocation, ~40% faster for that construction in isolation. | before (fmt) | after (strconv) | | sec/op | sec/op vs base | PrepareRequest-8 | 6.136µ ± 11% | 4.491µ ± 33% -26.80% (p=0.007 n=10)| B/op: 1008 -> 1008 (unchanged) allocs/op: 12 -> 12 (unchanged) No behavior change. Adds BenchmarkPrepareRequest, as per policy, exercising the request preparation path.