Skip to content

perf(ext/node): flush-free header fast path in HTTP parser#33351

Merged
bartlomieju merged 1 commit into
denoland:mainfrom
nathanwhit:http-parser-fast-path
Apr 22, 2026
Merged

perf(ext/node): flush-free header fast path in HTTP parser#33351
bartlomieju merged 1 commit into
denoland:mainfrom
nathanwhit:http-parser-fast-path

Conversation

@nathanwhit

@nathanwhit nathanwhit commented Apr 22, 2026

Copy link
Copy Markdown
Member

When no prior kOnHeaders flush occurred (all headers fit in the current parser.execute batch and total stayed under MAX_HEADER_PAIRS), pass accumulated headers and url directly to parserOnHeadersComplete as the 3rd/5th args, skipping the kOnHeaders JS call. The slow path (flush via kOnHeaders + pass undefined) is retained for chunked-across-packets or >MAX_HEADER_PAIRS cases.


This mimics node, and improves throughput by about 4% on hello world


Disclosure: used claude

When no prior kOnHeaders flush occurred (all headers fit in the
current parser.execute batch and total stayed under MAX_HEADER_PAIRS),
pass accumulated headers and url directly to parserOnHeadersComplete
as the 3rd/5th args, skipping the kOnHeaders JS call. The slow path
(flush via kOnHeaders + pass undefined) is retained for
chunked-across-packets or >MAX_HEADER_PAIRS cases.
@bartlomieju
bartlomieju merged commit b3568ec into denoland:main Apr 22, 2026
329 of 333 checks passed
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