René's URL Explorer Experiment


Title: util: add fast path to stripVTControlCharacters by privatenumber · Pull Request #61833 · nodejs/node · GitHub

Open Graph Title: util: add fast path to stripVTControlCharacters by privatenumber · Pull Request #61833 · nodejs/node

X Title: util: add fast path to stripVTControlCharacters by privatenumber · Pull Request #61833 · nodejs/node

Description: Problem stripVTControlCharacters always runs a regex replacement, even when the input contains no ANSI escape codes. This is the common case — most strings passed through are already plain text (e.g. checking/sanitizing user input, processing log lines that are mostly text). Changes Adds a StringPrototypeIndexOf guard for ESC (\u001B) and CSI (\u009B) before the regex. Since all ANSI escape sequences start with one of these introducers, their absence means no ANSI codes exist and we can return the string immediately — skipping regex execution. Based on the same optimization proposed in chalk/strip-ansi#54. Also adds a benchmark and test coverage for the fast path, 7-bit ESC sequences, and 8-bit CSI sequences. Benchmarks Node.js benchmark results using benchmark/compare.js (30 runs, two separate builds): confidence improvement accuracy (*) (**) (***) util/strip-vt-control-characters.js input='noAnsi-short' n=1000000 *** 93.43 % ±3.42% ±4.56% ±5.94% util/strip-vt-control-characters.js input='noAnsi-long' n=1000000 *** 591.26 % ±9.71% ±12.97% ±16.97% util/strip-vt-control-characters.js input='ansi-short' n=1000000 -0.32 % ±1.39% ±1.85% ±2.41% util/strip-vt-control-characters.js input='ansi-long' n=1000000 1.74 % ±2.55% ±3.39% ±4.42% ~1.93x faster for short non-ANSI strings, ~6.91x for long non-ANSI strings. Negligible impact on ANSI input.

Open Graph Description: Problem stripVTControlCharacters always runs a regex replacement, even when the input contains no ANSI escape codes. This is the common case — most strings passed through are already plain text (e....

X Description: Problem stripVTControlCharacters always runs a regex replacement, even when the input contains no ANSI escape codes. This is the common case — most strings passed through are already plain text (e....

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:73854cc7-b1fb-0454-0a2d-ed9fd2f8fd65
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id80AC:3F81E9:D08A5F:11D1BDF:6A4C58D1
html-safe-nonce122ca578e68bfd7cfca81e31d454f214df97dc220011263633b862136a77bf75
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEFDOjNGODFFOTpEMDhBNUY6MTFEMUJERjo2QTRDNThEMSIsInZpc2l0b3JfaWQiOiIyNjA2NzIwMDI1NzI2MDQ4NDY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8a276df34809851d2229298176d0ab6ee705692b51b291729836052ff12803b2
hovercard-subject-tagpull_request:3285855585
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/61833/files
twitter:imagehttps://avatars.githubusercontent.com/u/1075694?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1075694?s=400&v=4
og:image:altProblem stripVTControlCharacters always runs a regex replacement, even when the input contains no ANSI escape codes. This is the common case — most strings passed through are already plain text (e....
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
release14099438da5379150f15a2892474c7c7e6c0e55e
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/61833/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F61833%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%2F61833%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/61833/files
Reloadhttps://github.com/nodejs/node/pull/61833/files
Reloadhttps://github.com/nodejs/node/pull/61833/files
Please reload this pagehttps://github.com/nodejs/node/pull/61833/files
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/pull/61833/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
privatenumber:strip-vt-fast-pathhttps://github.com/privatenumber/node/tree/strip-vt-fast-path
Conversation 12 https://github.com/nodejs/node/pull/61833
Commits 5 https://github.com/nodejs/node/pull/61833/commits
Checks 34 https://github.com/nodejs/node/pull/61833/checks
Files changed 3 https://github.com/nodejs/node/pull/61833/files
util: add fast path to stripVTControlCharacters https://github.com/nodejs/node/pull/61833/files#top
Show all changes 5 commits https://github.com/nodejs/node/pull/61833/files
3929fc3 util: add fast path to stripVTControlCharacters privatenumber Feb 15, 2026 https://github.com/nodejs/node/pull/61833/commits/3929fc3a40586d7c4efe6f62bc28cc2f007c400a
bf4a28d fixup! util: add fast path to stripVTControlCharacters privatenumber Feb 15, 2026 https://github.com/nodejs/node/pull/61833/commits/bf4a28dbaafdec764b251293c35a89cad5961d16
003511d fixup! util: add fast path to stripVTControlCharacters privatenumber Feb 15, 2026 https://github.com/nodejs/node/pull/61833/commits/003511d1a607ffe1227db3e4ac43d06d041313aa
bacd1a7 fixup! util: add fast path to stripVTControlCharacters privatenumber Feb 16, 2026 https://github.com/nodejs/node/pull/61833/commits/bacd1a77c0aedfd00d428c5afbc2df5eb60e754c
911e04c fixup! util: add fast path to stripVTControlCharacters privatenumber Feb 16, 2026 https://github.com/nodejs/node/pull/61833/commits/911e04c946b85b4c42cb77c5c5c0d282125e201e
Clear filters https://github.com/nodejs/node/pull/61833/files
Please reload this pagehttps://github.com/nodejs/node/pull/61833/files
Please reload this pagehttps://github.com/nodejs/node/pull/61833/files
strip-vt-control-characters.js https://github.com/nodejs/node/pull/61833/files#diff-9a405dc46823b64f86a2439092727158a9f862e3b8b988efd8d01b7eb7d3bcc4
inspect.js https://github.com/nodejs/node/pull/61833/files#diff-ee826b416a72014ac81621cf3ecaeec6adcc40163f60775d157aa94618c80201
test-util.js https://github.com/nodejs/node/pull/61833/files#diff-c8b634012b69a5d9c99fe7991f357a4586bce17379cdee05044e7a9f34406832
benchmark/util/strip-vt-control-characters.jshttps://github.com/nodejs/node/pull/61833/files#diff-9a405dc46823b64f86a2439092727158a9f862e3b8b988efd8d01b7eb7d3bcc4
View file https://github.com/privatenumber/node/blob/911e04c946b85b4c42cb77c5c5c0d282125e201e/benchmark/util/strip-vt-control-characters.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/61833/{{ revealButtonHref }}
lib/internal/util/inspect.jshttps://github.com/nodejs/node/pull/61833/files#diff-ee826b416a72014ac81621cf3ecaeec6adcc40163f60775d157aa94618c80201
View file https://github.com/privatenumber/node/blob/911e04c946b85b4c42cb77c5c5c0d282125e201e/lib/internal/util/inspect.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/61833/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/61833/files#diff-ee826b416a72014ac81621cf3ecaeec6adcc40163f60775d157aa94618c80201
https://github.com/nodejs/node/pull/61833/files#diff-ee826b416a72014ac81621cf3ecaeec6adcc40163f60775d157aa94618c80201
test/parallel/test-util.jshttps://github.com/nodejs/node/pull/61833/files#diff-c8b634012b69a5d9c99fe7991f357a4586bce17379cdee05044e7a9f34406832
View file https://github.com/privatenumber/node/blob/911e04c946b85b4c42cb77c5c5c0d282125e201e/test/parallel/test-util.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/61833/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/61833/files#diff-c8b634012b69a5d9c99fe7991f357a4586bce17379cdee05044e7a9f34406832
Please reload this pagehttps://github.com/nodejs/node/pull/61833/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.