René's URL Explorer Experiment


Title: stream: improve performance of finished() by avcribl · Pull Request #59873 · nodejs/node · GitHub

Open Graph Title: stream: improve performance of finished() by avcribl · Pull Request #59873 · nodejs/node

X Title: stream: improve performance of finished() by avcribl · Pull Request #59873 · nodejs/node

Description: The changes optimize the end-of-stream.js module to only preserve AsyncLocalStorage context when it's actually needed, improving performance by avoiding ALS overhead in the common case where no async context tracking is active. The performance test results with this patch: ./out/Release/node ./benchmark/streams/end-of-stream.js streams/end-of-stream.js streamType="readable" n=100000: 3,290,307.950450068 streams/end-of-stream.js streamType="writable" n=100000: 1,004,954.4253168119 streams/end-of-stream.js streamType="duplex" n=100000: 893,658.706842607 The same perf test results with the current nodejs: node ./benchmark/streams/end-of-stream.js streams/end-of-stream.js streamType="readable" n=100000: 385,512.31905964843 streams/end-of-stream.js streamType="writable" n=100000: 348,685.1671624238 streams/end-of-stream.js streamType="duplex" n=100000: 382,477.79857896036 You can compare and see the noticeable performance improvement with this patch.

Open Graph Description: The changes optimize the end-of-stream.js module to only preserve AsyncLocalStorage context when it's actually needed, improving performance by avoiding ALS overhead in the common case where no...

X Description: The changes optimize the end-of-stream.js module to only preserve AsyncLocalStorage context when it's actually needed, improving performance by avoiding ALS overhead in the common case wher...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:31ef9fcd-1c0c-3f0c-0869-0c729a9371d4
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id83AC:3D95DA:142229C:1B60AD7:6A4C7CB3
html-safe-noncee18d0554d971d263c5154e418408b4e3658289a17fbd1a8b826beffbc20d22e4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0FDOjNEOTVEQToxNDIyMjlDOjFCNjBBRDc6NkE0QzdDQjMiLCJ2aXNpdG9yX2lkIjoiNjUzNzM4Nzg0Nzc4Njk4NjY3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc7716e09691155ea9165acb3322ba380b337d286892e4363662f2f5e0408f0c9
hovercard-subject-tagpull_request:2823960568
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/59873/files
twitter:imagehttps://avatars.githubusercontent.com/u/129687137?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/129687137?s=400&v=4
og:image:altThe changes optimize the end-of-stream.js module to only preserve AsyncLocalStorage context when it's actually needed, improving performance by avoiding ALS overhead in the common case where no...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c
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
releasecd470457e909b9d062f8002cf438ba870e6acff6
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/59873/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F59873%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F59873%2Ffiles
Sign up https://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/59873/files
Reloadhttps://github.com/nodejs/node/pull/59873/files
Reloadhttps://github.com/nodejs/node/pull/59873/files
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 964 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://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
avcribl:improve-stream-finished-perfhttps://github.com/avcribl/node/tree/improve-stream-finished-perf
Conversation 53 https://github.com/nodejs/node/pull/59873
Commits 9 https://github.com/nodejs/node/pull/59873/commits
Checks 40 https://github.com/nodejs/node/pull/59873/checks
Files changed https://github.com/nodejs/node/pull/59873/files
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
stream: improve performance of finished() https://github.com/nodejs/node/pull/59873/files#top
Show all changes 9 commits https://github.com/nodejs/node/pull/59873/files
765dd80 stream: preserve AsyncLocalStorage on finished only when needed avcribl Sep 13, 2025 https://github.com/nodejs/node/pull/59873/commits/765dd80f46959f2674added04ba7a520d8709ec4
f5595c6 benchmark: added finished benchmark avcribl Sep 13, 2025 https://github.com/nodejs/node/pull/59873/commits/f5595c6809bb2900fb376f1431ac8963c081466b
66dd3f6 removed async_hooks avcribl Sep 13, 2025 https://github.com/nodejs/node/pull/59873/commits/66dd3f670d0a18461a0a06c7ddffccbb332a510a
48db583 modified the benchmark test avcribl Sep 13, 2025 https://github.com/nodejs/node/pull/59873/commits/48db583d3f3271e0a1e5d8d56471e36d937d18e8
8e5b4a2 added check if no-async-context-frame is enabled or not avcribl Sep 16, 2025 https://github.com/nodejs/node/pull/59873/commits/8e5b4a23869b6569dd7ea2e473c3573f11f365e4
2d55f08 added unit tests avcribl Sep 17, 2025 https://github.com/nodejs/node/pull/59873/commits/2d55f081bbb5a562d64c2b5e4b26350e6a824269
a7f49d3 bumped the number of iterations avcribl Sep 17, 2025 https://github.com/nodejs/node/pull/59873/commits/a7f49d3b5b299ece908f67d256fd3cea064924a6
c49b350 fixed lint issues avcribl Sep 17, 2025 https://github.com/nodejs/node/pull/59873/commits/c49b350cd08a71f43e68c10499f07188d8334953
d51ca0d expanded on the unit test avcribl Sep 18, 2025 https://github.com/nodejs/node/pull/59873/commits/d51ca0dcb2a117a2e00b3a17eb985a9d37bf429f
Clear filters https://github.com/nodejs/node/pull/59873/files
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
finished.js https://github.com/nodejs/node/pull/59873/files#diff-f75319114710586becbd19e1c98460a3e4175e2ebc15508592d28d11b5931440
end-of-stream.js https://github.com/nodejs/node/pull/59873/files#diff-f355a772a51133f54ef288a365ec05a70b9f3f2e0a2f46f5ba2612e31a62f810
test-stream-finished-async-local-storage.js https://github.com/nodejs/node/pull/59873/files#diff-8593dc0f5191daec35a43f517202fc4c4cd724f7a44b70d5f30b1870c404ea13
test-stream-finished-bindAsyncResource-path.js https://github.com/nodejs/node/pull/59873/files#diff-cb976053111f6e4568f231f57695cfe3d8fc7439644f8bc6068f578c0bcaa312
test-stream-finished-default-path.js https://github.com/nodejs/node/pull/59873/files#diff-9817f046ad5636ea7be57044fd249aec5c7e190335d06471fed7bc5b97407436
benchmark/streams/finished.jshttps://github.com/nodejs/node/pull/59873/files#diff-f75319114710586becbd19e1c98460a3e4175e2ebc15508592d28d11b5931440
View file https://github.com/avcribl/node/blob/d51ca0dcb2a117a2e00b3a17eb985a9d37bf429f/benchmark/streams/finished.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/59873/{{ revealButtonHref }}
lib/internal/streams/end-of-stream.jshttps://github.com/nodejs/node/pull/59873/files#diff-f355a772a51133f54ef288a365ec05a70b9f3f2e0a2f46f5ba2612e31a62f810
View file https://github.com/avcribl/node/blob/d51ca0dcb2a117a2e00b3a17eb985a9d37bf429f/lib/internal/streams/end-of-stream.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/59873/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/59873/files#diff-f355a772a51133f54ef288a365ec05a70b9f3f2e0a2f46f5ba2612e31a62f810
https://github.com/nodejs/node/pull/59873/files#diff-f355a772a51133f54ef288a365ec05a70b9f3f2e0a2f46f5ba2612e31a62f810
https://github.com/nodejs/node/pull/59873/files#diff-f355a772a51133f54ef288a365ec05a70b9f3f2e0a2f46f5ba2612e31a62f810
https://github.com/nodejs/node/pull/59873/files#diff-f355a772a51133f54ef288a365ec05a70b9f3f2e0a2f46f5ba2612e31a62f810
test/parallel/test-stream-finished-async-local-storage.jshttps://github.com/nodejs/node/pull/59873/files#diff-8593dc0f5191daec35a43f517202fc4c4cd724f7a44b70d5f30b1870c404ea13
View file https://github.com/avcribl/node/blob/d51ca0dcb2a117a2e00b3a17eb985a9d37bf429f/test/parallel/test-stream-finished-async-local-storage.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/59873/{{ revealButtonHref }}
test/parallel/test-stream-finished-bindAsyncResource-path.jshttps://github.com/nodejs/node/pull/59873/files#diff-cb976053111f6e4568f231f57695cfe3d8fc7439644f8bc6068f578c0bcaa312
View file https://github.com/avcribl/node/blob/d51ca0dcb2a117a2e00b3a17eb985a9d37bf429f/test/parallel/test-stream-finished-bindAsyncResource-path.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/59873/{{ revealButtonHref }}
mcollinahttps://github.com/mcollina
Sep 18, 2025https://github.com/nodejs/node/pull/59873/files#r2358882347
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
mcollinahttps://github.com/mcollina
Sep 18, 2025https://github.com/nodejs/node/pull/59873/files#r2358882580
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
Flarnahttps://github.com/Flarna
Sep 18, 2025https://github.com/nodejs/node/pull/59873/files#r2358980671
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
avcriblhttps://github.com/avcribl
Sep 18, 2025https://github.com/nodejs/node/pull/59873/files#r2361340108
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
avcriblhttps://github.com/avcribl
Sep 24, 2025https://github.com/nodejs/node/pull/59873/files#r2375816153
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
@mcollinahttps://github.com/mcollina
Please reload this pagehttps://github.com/nodejs/node/pull/59873/files
test/parallel/test-stream-finished-default-path.jshttps://github.com/nodejs/node/pull/59873/files#diff-9817f046ad5636ea7be57044fd249aec5c7e190335d06471fed7bc5b97407436
View file https://github.com/avcribl/node/blob/d51ca0dcb2a117a2e00b3a17eb985a9d37bf429f/test/parallel/test-stream-finished-default-path.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/59873/{{ revealButtonHref }}
Please reload this pagehttps://github.com/nodejs/node/pull/59873/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.