Skip to content

Intern common Train-Case header names#2266

Open
pavel-ptashyts wants to merge 1 commit into
AsyncHttpClient:mainfrom
maygemdev:perf/train-case-header-interning
Open

Intern common Train-Case header names#2266
pavel-ptashyts wants to merge 1 commit into
AsyncHttpClient:mainfrom
maygemdev:perf/train-case-header-interning

Conversation

@pavel-ptashyts

@pavel-ptashyts pavel-ptashyts commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add prebuilt Train-Case AsciiString entries for common request header names
  • keep lowercase Netty header constants in the intern table
  • update the focused interning tests to cover Train-Case interning and odd-casing passthrough

Rationale

NettyRequestFactory already interns known lowercase header names so HttpHeadersEncoder can bulk-copy AsciiString bytes on the event loop. Real request code often supplies names such as Content-Type and Authorization in Train-Case, which previously missed the table and fell back to per-character encoding. Adding same-spelling AsciiString entries preserves wire casing while putting those common names on the same fast path.

Validation

  • ./mvnw -pl client -Dtest=NettyRequestFactoryHeaderInterningTest test
  • ./mvnw -pl client -DskipTests compile
  • ./mvnw -pl client -Dtest=BasicHttpTest,BasicHttp2Test,AutomaticDecompressionTest test

Attribution

Codex on behalf of Pavel Ptashyts

Extend NettyRequestFactory's known header-name table with prebuilt
Train-Case AsciiString instances for the common headers already covered
by lowercase Netty constants. This lets caller-supplied names such as
Content-Type and Authorization take the HttpHeadersEncoder bulk-copy
path while preserving on-wire casing.

Odd casing and custom header names still miss the table and pass
through unchanged. Update focused interning tests for Train-Case
interning and odd-casing passthrough.

Codex on behalf of Pavel Ptashyts

Co-Authored-By: Codex <codex@openai.com>
@pavel-ptashyts
pavel-ptashyts force-pushed the perf/train-case-header-interning branch from d64a80f to a142238 Compare July 20, 2026 08:50
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.

1 participant