René's URL Explorer Experiment


Title: Type stripping invalidates V8's ArrayBufferDetaching protector, slowing typed-array code for the rest of the process · Issue #67632 · nodejs/node · GitHub

Open Graph Title: Type stripping invalidates V8's ArrayBufferDetaching protector, slowing typed-array code for the rest of the process · Issue #67632 · nodejs/node

X Title: Type stripping invalidates V8's ArrayBufferDetaching protector, slowing typed-array code for the rest of the process · Issue #67632 · nodejs/node

Description: Version v26.13.0 (V8 14.6.202.34-node.40, amaro 1.1.11) and v27.0.0-alpha (V8 15.6.75.25-node.10, amaro 1.1.11) Platform Darwin arm64 (Apple M2 Pro) Subsystem module, typescript (deps: amaro) What steps will reproduce the bug? Stripping ...

Open Graph Description: Version v26.13.0 (V8 14.6.202.34-node.40, amaro 1.1.11) and v27.0.0-alpha (V8 15.6.75.25-node.10, amaro 1.1.11) Platform Darwin arm64 (Apple M2 Pro) Subsystem module, typescript (deps: amaro) What ...

X Description: Version v26.13.0 (V8 14.6.202.34-node.40, amaro 1.1.11) and v27.0.0-alpha (V8 15.6.75.25-node.10, amaro 1.1.11) Platform Darwin arm64 (Apple M2 Pro) Subsystem module, typescript (deps: amaro) What ...

Opengraph URL: https://github.com/nodejs/node/issues/67632

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type stripping invalidates V8's ArrayBufferDetaching protector, slowing typed-array code for the rest of the process","articleBody":"### Version\n\nv26.13.0 (V8 14.6.202.34-node.40, amaro 1.1.11) and v27.0.0-alpha (V8 15.6.75.25-node.10, amaro 1.1.11)\n\n### Platform\n\n```text\nDarwin arm64 (Apple M2 Pro)\n```\n\n### Subsystem\n\nmodule, typescript (deps: amaro)\n\n### What steps will reproduce the bug?\n\nStripping the types of a TypeScript source of more than about 2 KB invalidates V8's `ArrayBufferDetaching` protector. Running a `.ts` file does it, and so does `module.stripTypeScriptTypes()`:\n\n```js\n// strip.mjs\nimport { stripTypeScriptTypes } from 'node:module';\n\nconst count = Number(process.argv[2]);\nlet source = '';\nfor (let i = 0; i \u003c count; i++) {\n    source += `export function f${i}(a: number, b: number): number { return a + b; }\\n`;\n}\n\nstripTypeScriptTypes(source);\nconsole.log(`stripped ${source.length} bytes`);\n```\n\n```console\n$ node --no-warnings --trace-protector-invalidation strip.mjs 20\nstripped 1350 bytes\n$ node --no-warnings --trace-protector-invalidation strip.mjs 30\nInvalidating protector cell ArrayBufferDetaching\nstripped 2030 bytes\n```\n\nA 2.7 KB `.ts` entry point prints the same line, a 670-byte one doesn't, and the 2.7 KB file with its types removed by hand and saved as `.mjs` doesn't either.\n\nOnce the protector is invalid, optimized code checks typed-array accesses for detached buffers, in every module, until the process exits:\n\n```js\n// repro.mjs\n// node repro.mjs          protector intact\n// node repro.mjs strip    strips 20 KB of TypeScript first\nimport { stripTypeScriptTypes } from 'node:module';\n\nif (process.argv[2] === 'strip') {\n    let source = '';\n    for (let i = 0; i \u003c 300; i++) {\n        source += `export function f${i}(a: number, b: number): number { return a + b; }\\n`;\n    }\n    stripTypeScriptTypes(source);\n}\n\nconst values = new Float64Array(1000).map((_, i) => i);\n\nfunction sum() {\n    let total = 0;\n    for (let i = 0; i \u003c values.length; i++) total += values[i];\n    return total;\n}\n\nlet sink = 0;\nfor (let i = 0; i \u003c 200_000; i++) sink += sum();\n\nlet best = Infinity;\nfor (let round = 0; round \u003c 20; round++) {\n    const start = process.hrtime.bigint();\n    for (let i = 0; i \u003c 100_000; i++) sink += sum();\n    best = Math.min(best, Number(process.hrtime.bigint() - start) / 100_000);\n}\n\nconsole.log(`${process.version} ${process.argv[2] ?? 'intact'}: ${best.toFixed(0)} ns per sum`);\n```\n\nFastest of 20 rounds, three processes each, on an M2 Pro:\n\n| Node | intact | after stripping | ratio |\n| --- | ---: | ---: | ---: |\n| 26.13.0 | 1438–1456 ns | 5753–5796 ns | 4.0× |\n| 27.0.0-alpha | 782–795 ns | 854–860 ns | 1.08× |\n\nIn Node 27 this loop loses less, but the protector is still invalidated, and larger code loses more: a binary format library's `DataView` getters, loaded from `.ts`, took about 1.6× as long in both versions as when a `module.registerHooks` load hook stripped the same files with a native transform. Having amaro strip a 300-function string at startup, with that hook still in place, brought the slowdown back.\n\n### How often does it reproduce? Is there a required condition?\n\nAlways, once one stripped source is large enough to grow amaro's WebAssembly memory. Most real `.ts` files are.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nRunning a program from `.ts` should leave typed-array code as fast as running the same program from `.js`. Type stripping is stable and on by default, so a process pays this whenever it loads a TypeScript file, whether or not it ever detaches a buffer itself.\n\n### What do you see instead?\n\n`Invalidating protector cell ArrayBufferDetaching`, and slower typed-array and `DataView` code for the rest of the process.\n\n### Additional information\n\n**Cause.** amaro is swc compiled to WebAssembly. When its memory grows, V8 detaches the `ArrayBuffer` that `memory.buffer` returned before. amaro's wasm-bindgen glue holds two views of that buffer (`deps/amaro/dist/internal.js`):\n\n```js\ncachedDataViewMemory0 = new DataView(wasm.memory.buffer)\ncachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer)\n```\n\n**Why V8 15 doesn't fix it.** V8 now tracks a buffer's view, so that detaching can mark that view instead of invalidating the protector ([crbug 467645277](https://issues.chromium.org/issues/467645277), [a08ad9c](https://github.com/v8/v8/commit/a08ad9c9c382b93980a7e76e65594a734cecadda), on by default since [2031231](https://github.com/v8/v8/commit/20312319d9), V8 15.x). It handles a buffer with no view or with one `TypedArray`. A buffer with two views, or with a `DataView`, still invalidates the protector (`JSArrayBuffer::TryDetachViews`), and amaro's memory has both. With `views.mjs` below:\n\n```js\n// node --trace-protector-invalidation views.mjs \u003cnone|one|two|dataview>\nconst mode = process.argv[2];\nconst memory = new WebAssembly.Memory({ initial: 1 });\nconst views = [];\nif (mode === 'none') memory.buffer;\nif (mode === 'one' || mode === 'two') views.push(new Uint8Array(memory.buffer));\nif (mode === 'two') views.push(new Uint8Array(memory.buffer));\nif (mode === 'dataview') views.push(new DataView(memory.buffer));\nmemory.grow(1);\n```\n\n| | none | one | two | dataview |\n| --- | --- | --- | --- | --- |\n| Node 26.13.0 | invalidated | invalidated | invalidated | invalidated |\n| Node 26.13.0 `--track-array-buffer-views` | intact | intact | invalidated | invalidated |\n| Node 27.0.0-alpha | intact | intact | invalidated | invalidated |\n\n**Possible fixes**, none of which I have tried in amaro itself:\n\n- Build amaro's WebAssembly module with enough initial memory that stripping ordinary files never grows it. This would help every release line, including those whose V8 doesn't track views.\n- Have the glue take its views from `memory.toResizableBuffer()`, which `memory.grow()` resizes instead of detaching. In both versions above, growing such a memory with a `Uint8Array` and a `DataView` on it left the protector intact.\n- Have the glue hold a single `Uint8Array` and no `DataView`. This helps only where V8 tracks views (15.x).\n\nI haven't run Node 24, or `main` with amaro 1.3.0, whose glue still creates both views.\n\nOther built-in paths invalidate the protector in Node 26.13.0: reading a `fetch` or `Response` body, constructing a `Blob` from a typed array, enqueuing into a byte stream, and `ArrayBuffer.prototype.transfer()`. In Node 27.0.0-alpha none of them does, so type stripping is the one built-in path I found that still invalidates it there. It also differs in kind: those are things a program does, while type stripping happens before the program's first line runs.\n","author":{"url":"https://github.com/snovader","@type":"Person","name":"snovader"},"datePublished":"2026-11-19T22:47:09Z","url":"https://github.com/nodejs/node/issues/67632"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:21575f00-a397-5174-495d-ba2ebc9e7166
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD5FA:14227A:35109E:476DF7:6B061979
html-safe-nonce18da701bb8413a980d741b406934a645bd0ce78d249465d552a52bfd8d0958b2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUZBOjE0MjI3QTozNTEwOUU6NDc2REY3OjZCMDYxOTc5IiwidmlzaXRvcl9pZCI6IjUxNzcwMzcxNTY3MTU0NjkxNzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac546d20ea79c5db8041329deff4e8b9007f26fffba9da90763cf9656736487946
hovercard-subject-tagissue:6500613652
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/67632/issue_layout
twitter:imagehttps://opengraph.githubassets.com/21860e848dba453c13af3661199e6268f80169a60116dc507aabaf693ffafb3a/nodejs/node/issues/67632
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/21860e848dba453c13af3661199e6268f80169a60116dc507aabaf693ffafb3a/nodejs/node/issues/67632
og:image:altVersion v26.13.0 (V8 14.6.202.34-node.40, amaro 1.1.11) and v27.0.0-alpha (V8 15.6.75.25-node.10, amaro 1.1.11) Platform Darwin arm64 (Apple M2 Pro) Subsystem module, typescript (deps: amaro) What ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesnovader
hostnamegithub.com
expected-hostnamegithub.com
None97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release866f202ebf7ac5aff8f633417d9fd8a53818a977
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/67632#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F67632
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%2Fissues%2F67632
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/67632
Reloadhttps://github.com/nodejs/node/issues/67632
Reloadhttps://github.com/nodejs/node/issues/67632
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues630 (630)https://github.com/nodejs/node/issues
Pull requests659 (659)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/insights
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67632
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67632
Type stripping invalidates V8's ArrayBufferDetaching protector, slowing typed-array code for the rest of the processhttps://github.com/nodejs/node/issues/67632#top
strip-typeshttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22strip-types%22
https://github.com/snovader
snovaderhttps://github.com/snovader
on Nov 19, 2026https://github.com/nodejs/node/issues/67632#issue-6500613652
crbug 467645277https://issues.chromium.org/issues/467645277
a08ad9chttps://github.com/v8/v8/commit/a08ad9c9c382b93980a7e76e65594a734cecadda
2031231https://github.com/v8/v8/commit/20312319d9
https://github.com/bakkot
bakkothttps://github.com/bakkot
on Nov 21, 2026https://github.com/nodejs/node/issues/67632#issuecomment-7056439949
snovaderhttps://github.com/snovader
on Nov 21, 2026https://github.com/nodejs/node/issues/67632#event-36847396364
perf: start with 16 MiB of memory, so that stripping most sources doe…https://github.com/snovader/amaro/commit/a3f5feb9ec42089384f8b08b464d5ad9884b7fe3
a3f5febhttps://github.com/snovader/amaro/commit/a3f5feb9ec42089384f8b08b464d5ad9884b7fe3
perf: resize the memory's buffer in place instead of detaching ithttps://github.com/snovader/amaro/commit/042fe4e25ad2794a5e403437ff2b7a90a7b693e4
042fe4ehttps://github.com/snovader/amaro/commit/042fe4e25ad2794a5e403437ff2b7a90a7b693e4
perf: start with 16 MiB of memory, so that most sources don't grow ithttps://github.com/snovader/amaro/commit/0a371621834c56b6afcf86d607fce5f61d02f784
0a37162https://github.com/snovader/amaro/commit/0a371621834c56b6afcf86d607fce5f61d02f784
perf: resize the memory's buffer in place instead of detaching ithttps://github.com/snovader/amaro/commit/b8e9e362a83524acd0a4a980d533a74a6d26d4be
b8e9e36https://github.com/snovader/amaro/commit/b8e9e362a83524acd0a4a980d533a74a6d26d4be
Renegade334https://github.com/Renegade334
strip-typeshttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22strip-types%22
on Nov 21, 2026https://github.com/nodejs/node/issues/67632#event-36854204445
snovaderhttps://github.com/snovader
on Nov 23, 2026https://github.com/nodejs/node/issues/67632#event-37023525246
perf: start with 16 MiB of memory, so that most sources don't grow ithttps://github.com/snovader/amaro/commit/1f309918ec123362ad5fafc136e552508aeea0a2
1f30991https://github.com/snovader/amaro/commit/1f309918ec123362ad5fafc136e552508aeea0a2
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/67632
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/67632
strip-typeshttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22strip-types%22
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.