Skip to content

Streamline HTTP/2 request header copy#2181

Merged
hyperxpro merged 2 commits into
mainfrom
perf/h2-header-copy
Jun 4, 2026
Merged

Streamline HTTP/2 request header copy#2181
hyperxpro merged 2 commits into
mainfrom
perf/h2-header-copy

Conversation

@hyperxpro
Copy link
Copy Markdown
Member

Motivation:

sendHttp2Frames copies HTTP/1.1 headers into Http2Headers on every HTTP/2 request (hot path):
String-materializes each name, toLowerCase() per name, HashSet probe — plus a
path + "?" + query concat for :path.

Modification:

:path from Uri.toRelativeUrl() (pooled, byte-identical); copy via iteratorCharSequence() +
AsciiString.contentEqualsIgnoreCase against HttpHeaderNames, dropping HTTP2_EXCLUDED_HEADERS.
Still lowercases (validating DefaultHttp2Headers throws on uppercase) but allocation-free when
already lowercase. Adds wire + :path-equivalence tests; updates the JMH benchmark.

Result:

Behavior-preserving; ~1.17x faster, -24 B/op (JMH, JDK 11). Full CI matrix green.

…header validation'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@hyperxpro hyperxpro merged commit a004274 into main Jun 4, 2026
17 checks passed
@hyperxpro hyperxpro deleted the perf/h2-header-copy branch June 4, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants