Skip to content

perf(http2): reduce writeH2 per-request callback allocations#5138

Merged
mcollina merged 1 commit into
nodejs:mainfrom
trivikr:h2-per-request-closure-allocation
Apr 30, 2026
Merged

perf(http2): reduce writeH2 per-request callback allocations#5138
mcollina merged 1 commit into
nodejs:mainfrom
trivikr:h2-per-request-closure-allocation

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Apr 30, 2026

This relates to...

Reduces allocation churn in the HTTP/2 request write path.

Rationale

writeH2 created a few request-local cleanup/error callbacks that did not need to capture request-local state.
Under high concurrency, these extra closures add avoidable allocation pressure.

Changes

Hoists shared HTTP/2 stream cleanup handlers and uses per-stream symbol state only where needed.

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

Assisted-by: openai:gpt-5.5

Assisted-by: openai:gpt-5.5
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (aeed21a) to head (90f2fdd).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5138   +/-   ##
=======================================
  Coverage   93.15%   93.16%           
=======================================
  Files         110      110           
  Lines       36212    36234   +22     
=======================================
+ Hits        33735    33757   +22     
  Misses       2477     2477           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 86f1242 into nodejs:main Apr 30, 2026
35 checks passed
@trivikr trivikr deleted the h2-per-request-closure-allocation branch May 1, 2026 00:29
@github-actions github-actions Bot mentioned this pull request May 1, 2026
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.

4 participants