René's URL Explorer Experiment


Title: lib: optimize FixedQueue by reusing one segment by gurgunday · Pull Request #60031 · nodejs/node · GitHub

Open Graph Title: lib: optimize FixedQueue by reusing one segment by gurgunday · Pull Request #60031 · nodejs/node

X Title: lib: optimize FixedQueue by reusing one segment by gurgunday · Pull Request #60031 · nodejs/node

Description: Benchmarks: main: node % ./node benchmark/run.js --filter fixed-queue util util/fixed-queue-oscillate.js util/fixed-queue-oscillate.js cycles=5000: 240,760,722.06068513 util/fixed-queue.js util/fixed-queue.js n=100000: 30,605,608.47775355 branch: node % ./node benchmark/run.js --filter fixed-queue util util/fixed-queue-oscillate.js util/fixed-queue-oscillate.js cycles=5000: 283,339,287.4243814 util/fixed-queue.js util/fixed-queue.js n=100000: 32,606,927.0808029 When the head segment fills, we reuse a “spare” FixedCircularBuffer if available; when a segment becomes empty, we reset it and stash it as the spare instead of wasting it. This cuts allocations/GC especially when the queue oscillates between N and N+1 segments, which is more than likely to be the case in real life scenarios where Events/Promises/Tasks are emitted/created and consumed in bursts. We only call reset() when reusing a spare (not for a freshly allocated buffer). And finally, there is no behavior change: we have the same data structure (linked fixed-size circular buffers), same invariants (one-slot-wasted), same FIFO semantics and API. Capacity per segment stays kSize - 1, so overall capacity is unchanged.

Open Graph Description: Benchmarks: main: node % ./node benchmark/run.js --filter fixed-queue util util/fixed-queue-oscillate.js util/fixed-queue-oscillate.js cycles=5000: 240,760,722.06068513 util/fixed-queue.js util/fix...

X Description: Benchmarks: main: node % ./node benchmark/run.js --filter fixed-queue util util/fixed-queue-oscillate.js util/fixed-queue-oscillate.js cycles=5000: 240,760,722.06068513 util/fixed-queue.js util/fix...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:24b8bf60-4893-98d1-d04f-03bd8d09e278
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9CE4:13DA2D:FDF52B:1701D87:6A4CCE59
html-safe-nonce3b65270311db724d56d7252fd810397d3459e2a6ae97556762bbb1e3afb2f92e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0U0OjEzREEyRDpGREY1MkI6MTcwMUQ4Nzo2QTRDQ0U1OSIsInZpc2l0b3JfaWQiOiI1MTY3MzE4NTA5MDAwOTA0MjgxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac681d87b004e6566b9b121ab08c2beda6a564faeb824ddc39d6bd36fb8f141532
hovercard-subject-tagpull_request:2866282164
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/60031/files
twitter:imagehttps://avatars.githubusercontent.com/u/74139498?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/74139498?s=400&v=4
og:image:altBenchmarks: main: node % ./node benchmark/run.js --filter fixed-queue util util/fixed-queue-oscillate.js util/fixed-queue-oscillate.js cycles=5000: 240,760,722.06068513 util/fixed-queue.js util/fix...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneee8a9d18044a05fe2d57b9ae797da38c8be34effb03f015f7c42e94770d28a1b
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
releasef84814acc6f036583fd43463f5847a846243d2a4
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/60031/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F60031%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%2F60031%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/60031/files
Reloadhttps://github.com/nodejs/node/pull/60031/files
Reloadhttps://github.com/nodejs/node/pull/60031/files
Please reload this pagehttps://github.com/nodejs/node/pull/60031/files
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/pull/60031/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 962 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
gurgundayhttps://github.com/gurgunday
nodejs:mainhttps://github.com/nodejs/node/tree/main
gurgunday:fixed-queuehttps://github.com/gurgunday/node/tree/fixed-queue
Conversation 16 https://github.com/nodejs/node/pull/60031
Commits 1 https://github.com/nodejs/node/pull/60031/commits
Checks 20 https://github.com/nodejs/node/pull/60031/checks
Files changed https://github.com/nodejs/node/pull/60031/files
Please reload this pagehttps://github.com/nodejs/node/pull/60031/files
lib: optimize FixedQueue by reusing one segment https://github.com/nodejs/node/pull/60031/files#top
Show all changes 1 commit https://github.com/nodejs/node/pull/60031/files
c99a6c4 lib: optimize FixedQueue by reusing emptied segment gurgunday Oct 3, 2025 https://github.com/nodejs/node/pull/60031/commits/c99a6c461363e398c095214d26d0ca413fae281c
Clear filters https://github.com/nodejs/node/pull/60031/files
Please reload this pagehttps://github.com/nodejs/node/pull/60031/files
Please reload this pagehttps://github.com/nodejs/node/pull/60031/files
fixed-queue.js https://github.com/nodejs/node/pull/60031/files#diff-65ae2bc4b9e2a083798b48772a30c428efb79e455f742edbd249131e4166134e
fixed_queue.js https://github.com/nodejs/node/pull/60031/files#diff-9db996caaaf873d3d9921a19336a08a19fc48d5ad2d42de96a97931dd98f2796
benchmark/util/fixed-queue.jshttps://github.com/nodejs/node/pull/60031/files#diff-65ae2bc4b9e2a083798b48772a30c428efb79e455f742edbd249131e4166134e
View file https://github.com/gurgunday/node/blob/c99a6c461363e398c095214d26d0ca413fae281c/benchmark/util/fixed-queue.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/60031/{{ revealButtonHref }}
lib/internal/fixed_queue.jshttps://github.com/nodejs/node/pull/60031/files#diff-9db996caaaf873d3d9921a19336a08a19fc48d5ad2d42de96a97931dd98f2796
View file https://github.com/gurgunday/node/blob/c99a6c461363e398c095214d26d0ca413fae281c/lib/internal/fixed_queue.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/60031/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/60031/files#diff-9db996caaaf873d3d9921a19336a08a19fc48d5ad2d42de96a97931dd98f2796
https://github.com/nodejs/node/pull/60031/files#diff-9db996caaaf873d3d9921a19336a08a19fc48d5ad2d42de96a97931dd98f2796
https://github.com/nodejs/node/pull/60031/files#diff-9db996caaaf873d3d9921a19336a08a19fc48d5ad2d42de96a97931dd98f2796
https://github.com/nodejs/node/pull/60031/files#diff-9db996caaaf873d3d9921a19336a08a19fc48d5ad2d42de96a97931dd98f2796
Please reload this pagehttps://github.com/nodejs/node/pull/60031/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.