René's URL Explorer Experiment


Title: http: reduce per-request allocations in the server by mcollina · Pull Request #65802 · nodejs/node · GitHub

Open Graph Title: http: reduce per-request allocations in the server by mcollina · Pull Request #65802 · nodejs/node

X Title: http: reduce per-request allocations in the server by mcollina · Pull Request #65802 · nodejs/node

Description: Removes allocations and repeated work the HTTP server performs for every request: Per-request bound functions: updateOutgoingData.bind() becomes one closure per connection reused by every response, and the per-request resOnFinish.bind() becomes a shared 'finish' listener that reaches everything through the connection state stored on the response. req.headers materialization: the requireHostHeader check (req.headers.host), the Expect check, and optimizeEmptyRequests' body-header check now scan rawHeaders (over the same range the headers getter exposes) instead of building the whole headers object — with a toLowerCase() per header name — for every request even when the application never reads req.headers. ServerResponse options object: cached per server; custom response classes keep receiving a fresh object since they may retain or mutate it. Status line: cached per status code when the reason phrase is the default (also skipping its character validation, which cannot fail for the built-in phrases). Date: header line: the complete line is cached alongside the existing one-second utcDate() cache. Keep-alive header pair: Connection: keep-alive\r\nKeep-Alive: timeout=N is rendered once per server settings instead of per response. Lenient-validation lookup: the 4-level option chain is computed once per message. Responses are byte-identical to main (verified by diffing raw responses). Benchmarks (i7-7700, server pinned to one core, wrk -t2 -c50 on separate physical cores, interleaved rounds, CPU from /proc//stat): workload main this PR Δ hello world, 1 request header 26.0 µs/req 24.2 µs/req −6.9% CPU, +7.5% req/s (8/8 rounds) hello world, 8 request headers 28.7 µs/req 25.3 µs/req −11.8% CPU, +13% req/s (5/5 rounds) Sampled heap allocation drops from 5206 to 4531 B/request (−13%); the req.headers build (~200 B + per-name toLowerCase per request) disappears from the profile entirely. test/parallel/test-http-*, test-http2-*, test-stream-*, test-net-*, test-https-* and the http diagnostics-channel suites all pass (1171 tests). Follow-up to #65732 and #65749. 🤖 Generated with Claude Code https://claude.ai/code/session_01TV8WVjiHJPR2hW4D6h1Xpr

Open Graph Description: Removes allocations and repeated work the HTTP server performs for every request: Per-request bound functions: updateOutgoingData.bind() becomes one closure per connection reused by every response...

X Description: Removes allocations and repeated work the HTTP server performs for every request: Per-request bound functions: updateOutgoingData.bind() becomes one closure per connection reused by every response...

Opengraph URL: https://github.com/nodejs/node/pull/65802

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:c798c039-92cc-17f4-b694-19cefbed28d6
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDB0E:33C72F:7CAE36:A2016F:6AED3484
html-safe-noncee7770281fd4cdf9a3e0e5c48771ced85e6bdb499abd2a0632e09a85fab512cf9
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjBFOjMzQzcyRjo3Q0FFMzY6QTIwMTZGOjZBRUQzNDg0IiwidmlzaXRvcl9pZCI6IjI5NDQwMjgwNjk3NjE3MjU1NzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaceb09391f5eea17be56a514790fe7036741198defe6a405205fd2506c506a76cd
hovercard-subject-tagpull_request:4445918616
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/nodejs/node/pull/65802/files
twitter:imagehttps://avatars.githubusercontent.com/u/52195?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/52195?s=400&v=4
og:image:altRemoves allocations and repeated work the HTTP server performs for every request: Per-request bound functions: updateOutgoingData.bind() becomes one closure per connection reused by every response...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonee51d0b7b5ab34b1688c05b54c3ed17b8658b2fa9bca973a9c740683ccb12cf4a
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release59ebb7b901cc154ecc179a44f266fcf69f343b30
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/65802/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F65802%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F65802%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/pull/65802/files
Reloadhttps://github.com/nodejs/node/pull/65802/files
Reloadhttps://github.com/nodejs/node/pull/65802/files
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues656 (656)https://github.com/nodejs/node/issues
Pull requests665 (665)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
nodejs-github-bothttps://github.com/nodejs-github-bot
nodejs:mainhttps://github.com/nodejs/node/tree/main
mcollina:http-reduce-request-allocationshttps://github.com/mcollina/node/tree/http-reduce-request-allocations
Conversation 18 https://github.com/nodejs/node/pull/65802
Commits 1 https://github.com/nodejs/node/pull/65802/commits
Checks 81 https://github.com/nodejs/node/pull/65802/checks
Files changed https://github.com/nodejs/node/pull/65802/files
Please reload this pagehttps://github.com/nodejs/node/pull/65802/files
http: reduce per-request allocations in the server https://github.com/nodejs/node/pull/65802/files#top
Show all changes 1 commit https://github.com/nodejs/node/pull/65802/files
ed051a3 http: reduce per-request allocations in the server mcollina Sep 4, 2026 https://github.com/nodejs/node/pull/65802/commits/ed051a3756dc20dc5f27648d90e1cf1ed0dfbc19
Clear filters https://github.com/nodejs/node/pull/65802/files
Please reload this pagehttps://github.com/nodejs/node/pull/65802/files
Please reload this pagehttps://github.com/nodejs/node/pull/65802/files
_http_incoming.js https://github.com/nodejs/node/pull/65802/files#diff-91659c35a59a70aaf7db1c7cec1fcbcd5b78b33f9b37f9babfb140d099229446
_http_outgoing.js https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
_http_server.js https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
http.js https://github.com/nodejs/node/pull/65802/files#diff-4cac473cd84f89f39f5dc2e74299ec3bd6e55d7b4842520143cdee1f62500c8f
lib/_http_incoming.jshttps://github.com/nodejs/node/pull/65802/files#diff-91659c35a59a70aaf7db1c7cec1fcbcd5b78b33f9b37f9babfb140d099229446
View file https://github.com/mcollina/node/blob/ed051a3756dc20dc5f27648d90e1cf1ed0dfbc19/lib/_http_incoming.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65802/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/65802/files#diff-91659c35a59a70aaf7db1c7cec1fcbcd5b78b33f9b37f9babfb140d099229446
lib/_http_outgoing.jshttps://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
View file https://github.com/mcollina/node/blob/ed051a3756dc20dc5f27648d90e1cf1ed0dfbc19/lib/_http_outgoing.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65802/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
https://github.com/nodejs/node/pull/65802/files#diff-48d21edbddb6e855d1ee5716c49bcdc0d913c11ee8a24a98ea7dbc60cd253556
lib/_http_server.jshttps://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
View file https://github.com/mcollina/node/blob/ed051a3756dc20dc5f27648d90e1cf1ed0dfbc19/lib/_http_server.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65802/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
https://github.com/nodejs/node/pull/65802/files#diff-2464899ab38c61dd42654fdb9658c75989cb6883b9c9d76613872a12d3fe2780
lib/internal/http.jshttps://github.com/nodejs/node/pull/65802/files#diff-4cac473cd84f89f39f5dc2e74299ec3bd6e55d7b4842520143cdee1f62500c8f
View file https://github.com/mcollina/node/blob/ed051a3756dc20dc5f27648d90e1cf1ed0dfbc19/lib/internal/http.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/65802/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/65802/files#diff-4cac473cd84f89f39f5dc2e74299ec3bd6e55d7b4842520143cdee1f62500c8f
https://github.com/nodejs/node/pull/65802/files#diff-4cac473cd84f89f39f5dc2e74299ec3bd6e55d7b4842520143cdee1f62500c8f
https://github.com/nodejs/node/pull/65802/files#diff-4cac473cd84f89f39f5dc2e74299ec3bd6e55d7b4842520143cdee1f62500c8f
https://github.com/nodejs/node/pull/65802/files#diff-4cac473cd84f89f39f5dc2e74299ec3bd6e55d7b4842520143cdee1f62500c8f
https://github.com/nodejs/node/pull/65802/files#diff-4cac473cd84f89f39f5dc2e74299ec3bd6e55d7b4842520143cdee1f62500c8f
Please reload this pagehttps://github.com/nodejs/node/pull/65802/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.