Parents: #473, #493 Related: #460, #461, #519, #556, #557
Problem
SerializeJSONObject builds every property value in a fresh temporary buffer, copies it into an object-local temporary buffer, then copies that complete object into its parent. A depth-n acyclic chain therefore recopies the growing encoded suffix at every ancestor. The #556 exact-parent rows still reach 178.7 million candidate instructions and about 2.55 GB peak RSS at depth 4,096 after active-cycle membership itself became indexed; the real-cycle row, which throws before unwinding successful output, needs only 21.9 million instructions and about 57 MB peak RSS.
Scope
- Reuse the benchmark-first depth 512/1,024/2,048/4,096 rows landed in
4be2bc64, and add controls only if needed to isolate omission/pretty-print behavior before the runtime change. - Serialize object members into one authoritative output buffer with exact rollback for values omitted by
undefined, callable, or Symbol semantics. - Eliminate successful-child recopy at each ancestor while preserving braces, commas, indentation, property order, and abrupt completion.
- Keep output growth bounded by the existing allocator/depth contracts and release invocation-local storage on success, throw, or OOM.
No-workaround rules
- No lower depth cap, flattened input preprocessing, output precomputation, benchmark recognition, callback suppression, changed omission semantics, global scratch buffer, system JSON library, or altered property order.
- Do not touch stacks, queues, jobs, Promise/microtask, or Worker lifecycle code.
Acceptance
- Benchmark-first acyclic depth rows with frozen topology, output length/leaf position/checksums, construction outside timing, ten warmups, and one scored job exist before the runtime change.
- Successful nested object output performs O(total output bytes + visited properties) copying rather than copying each descendant suffix at every ancestor.
- Empty objects, first/middle/last omitted properties, getters, replacer/toJSON, Proxy keys/descriptors, pretty indentation, throws, and property order preserve exact behavior.
- Focused OOM/deep/GC/TSan, forced execution modes where eligible, JSON.stringify test262, and full units pass without regressions.
- Seven-pair exact-parent evidence publishes wall, CPU, peak RSS, instructions/cycles/energy availability, thermal state, and dispersion with no discarded samples; shallow/wide controls remain neutral.
Security boundary
Nesting depth, output width, omitted-member placement, callback/proxy behavior, and allocation pressure are attacker-controlled. The fix removes amplification without exposing partial output or weakening exact SerializeJSONObject ordering and abrupt-completion rules.
Resolution
- Runtime:
3ec9847f - Evidence:
61652299 - Exact-parent overview