Parent: #473
Measured problem
At e07db37, JsonParser.parseString scans an
unescaped prefix, then restarts at the opening content byte when it encounters
an escape. Its decoding loop appends each ordinary byte separately.
The current-code Debug runner reproduced this on the Apple M2 Pro with Zig
0.17.0-dev.1770+5d7cf3f and the CI-pinned real zig-gc. Parsing a JSON string
with two 65,536-byte ordinary spans separated by one newline escape 256 times
returns checksum 33593088. A same-length plain-string control returns the same
checksum. Initial diagnostic instruction counts are 12,415,348,795 escaped vs
5,933,011,039 plain. These are single-run diagnostics, not a throughput claim.
A separate 2,048-iteration run was sampled: the ordinary-byte append site accounts for 670 of 1,737 main-thread samples in its dominant call stack. The sample also exposes per-byte ArrayList capacity bookkeeping. The run completed with checksum 268744704 under the unchanged 3 GB process-tree guard.
Intended change and completion gate
- Reuse the validated prefix; append maximal ordinary spans between escapes.
- Preserve raw-control rejection, every escape, WTF-8/lone surrogates, property keys, reviver source text, and allocation-failure propagation.
- Pin direct parser/OOM tests plus the Node-confirmed 85-check JS fixture.
- Compare affected JSON test262 outcomes and required-VM/tree witnesses using the preserved exact baseline and the candidate.
- Save before/after samples and controls with explicit build-mode/scope limits; do not claim a general production or JSC throughput win from Debug diagnostics.
The implementation will be committed and pushed independently; evidence and the close receipt will link the resulting commit and checked-in report.