Repository navigation
perf: use byte search to split response headers - #2796
Merged
dunglas merged 2 commits intoNov 1, 2026
Merged
Conversation
dunglas
approved these changes
Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Response header splitting scans for
:one byte at a time. Usebytes.IndexByteto find the same first separator while keeping the existing key/value copies and space-only trimming.Add table tests, a differential fuzz test, and a direct splitting benchmark, including missing separators, embedded NUL bytes, tabs, and additional colons.
Initial standalone measurements (Go 1.27.3, Apple M2, darwin/arm64, one 150ms sample per case):
X-Request-IdAccess-Control-Allow-CredentialsContent-TypeThese exploratory helper measurements are not a statistical comparison or a whole-request speedup claim. Benchmarks were not rerun for this PR.
Validation:
gofmtandgit diff --checkpassed. The exact CGO helper and its added tests passed with-racein an isolated harness; differential fuzzing passed 631,569 executions, andgo vetpassed. Full FrankenPHP tests were not run locally because the required PHP ZTS/shared-library and watcher setup is unavailable.