Skip to content

http: replace per-request ODCDS filter virtual dispatch with variant#45917

Open
akonradi wants to merge 1 commit into
envoyproxy:mainfrom
akonradi:odcds-filter-less-virtual-dispatch
Open

http: replace per-request ODCDS filter virtual dispatch with variant#45917
akonradi wants to merge 1 commit into
envoyproxy:mainfrom
akonradi:odcds-filter-less-virtual-dispatch

Conversation

@akonradi

@akonradi akonradi commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Commit Message:
Make DecodeHeadersBehavior a thin wrapper around a variant<Rds, CdsRds> and dispatch decodeHeaders via visit instead of a virtual call, avoiding the vtable indirection on the decode-headers hot path.

Additional Description:
This also removes one heap allocation on filter construction. It does so by moving storage inline into the filter.

This change was implemented with AI but is approximately what I would have written myself.

Risk Level: low
Testing: ran unit tests
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

@akonradi akonradi force-pushed the odcds-filter-less-virtual-dispatch branch from f6c8998 to cb6082b Compare July 1, 2026 16:27
@akonradi akonradi changed the title http: replace per-request ODCDS filter virtual dispatch with std::variant http: replace per-request ODCDS filter virtual dispatch with variant Jul 1, 2026
Make DecodeHeadersBehavior a thin wrapper around an absl::variant<Rds, CdsRds>
and dispatch decodeHeaders via absl::visit instead of a virtual call, avoiding
the vtable indirection on the decode-headers hot path.

Signed-off-by: Alex Bakon <abakon@netflix.com>
@akonradi akonradi force-pushed the odcds-filter-less-virtual-dispatch branch from cb6082b to 7912d3f Compare July 1, 2026 19:24
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