Skip to content

[v26.x] deps: backport V8 two-byte JSON stringification - #67834

Draft
marcpems wants to merge 4 commits into
nodejs:v26.x-stagingfrom
marcpems:v26-json-simd
Draft

marcpems wants to merge 4 commits into
nodejs:v26.x-stagingfrom
marcpems:v26-json-simd

Conversation

@marcpems

@marcpems marcpems commented Nov 27, 2026 •

Copy link
Copy Markdown

Backport only the fast two-byte JSON.stringify path from V8 d4966a98, including the applicable unaligned-load and Highway fallback changes. The local follow-up avoids overlapping vector scans around adjacent escapes. The remaining changes are the V8 embedder version bump and one functional mjsunit test for boundaries, escapes and surrogate handling.

Parser explicitly excluded: dense-escape parsing regressed in earlier combined builds. We do not have evidence that this case is sufficiently uncommon to accept the regression. Both parser source and header match the v26.x-staging base; no decoder selector or parser performance claim is included.

Split-build validation (ThinLTO, no PGO): On Snapdragon X2 Elite, using the v26.13.1 verification build, median paired object-property stringify throughput was 2.53x stock for unescaped CJK and 1.24x for mixed escapes. With a quote every eight code units it was 0.954x stock (only two of six rounds faster); the earlier gain at this spacing did not replicate. Short bare-string Arm probes also flagged possible clean CJK and Latin-1 losses. The three Arm application comparisons did not bound regressions to 1%.

The native Windows x64 run built the exact split head and passed the functional test. On AMD EPYC 9V74, median paired bare-string throughput was 0.998x–1.009x stock across six shapes. This did not test the object-property cases or establish an application-wide speedup. Keeping the PR draft pending resolution of the Arm signals, matched x64 object-property measurements, release-equivalent PGO and review.

Backport the JSON portions of V8 d4966a986bbe, including the parser prerequisite 2990d03d9851, unaligned reads from fc3551409efe and capped Highway tags from 7e56c4c6066f. Omit the general mixed-width string comparison change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/security-wg
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. v26.x Issues that can be reproduced on v26.x or PRs targeting the v26.x-staging branch. v8 engine Issues and PRs related to the V8 dependency. labels Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

marcpems and others added 3 commits November 27, 2026 19:46
Resume vector scanning after a clean run. Avoid empty copies and use the known encoded widths for JSON escape table entries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Limit scalar recovery to gaps below half a vector so a quote every eight UTF-16 code units does not keep the stringifier in scalar mode.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the v26 parser unchanged rather than trade dense-escape parsing regressions for sparse-input throughput.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@marcpems marcpems changed the title [v26.x] deps: backport V8 two-byte JSON scanning [v26.x] deps: backport V8 two-byte JSON stringification Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency. v26.x Issues that can be reproduced on v26.x or PRs targeting the v26.x-staging branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants