Problem
After #564 removes structural-part materialization from plain format, exact attribution still records roughly 1,920,016 backing allocations for 384,000 steady default NumberFormat calls (about five per call). The scored invocation adds 257,820,286 backing bytes for the default row, 258,996,523 for fixed fraction, 258,996,515 for localized fixed fraction, and 341,523,169 for the significant-digit/compact uncommon row.
nfRound currently formats the integer into arena storage, builds the fraction in an independently growing list, copies it through toOwnedSlice, and rebuilds zero-padded integers through repeated allocPrint. Scientific exponents and exact-decimal padding add related temporary formatting allocations.
Scope
- Freeze exact-checksum controls for default integer/fraction, fixed fraction, significant digits, rounding increment/mode, scientific/engineering, compact, large finite values, negative zero, and exact decimal-string inputs.
- Represent rounded ASCII integer/fraction components in caller-owned native scratch with a capacity derived from ECMA-402 option bounds and finite-number limits, formatting and padding each component once.
- Let the direct text sink consume scratch while it is live; the structural sink must own only bytes retained by returned parts. Preserve borrowed exact-decimal input when no transformation is required.
- Cover exponent formatting and every rounding path without duplicating the rounding algorithm.
No-workaround rules
- No workload/locale recognition, arbitrary fixed truncation, unsafe stack borrowing, lossy f64 shortcuts for exact decimal strings or BigInt, unbounded cache, or skipped numbering/grouping behavior.
- Preserve ECMA-402 rounding modes/increments/priorities, significant/fraction digit limits, coercion order, negative zero, non-finite values, exact part boundaries, OOM behavior, and moving/no-GIL ownership.
Acceptance
- Focused controls and attribution are frozen at the exact parent before implementation.
- Seven-pair exact-parent evidence improves common direct-text rows and does not regress significant/scientific/compact or structural controls outside noise.
- Scored allocation requests, cumulative backing bytes, and current backing bytes fall on the frozen steady rows.
format(x) === formatToParts(x).map(p => p.value).join("")remains true across every covered rounding family and numbering system.- Exact-parent Intl402 NumberFormat and BigInt locale compatibility remain regression-free.
- OOM, bounded heap, moving GC, no-GIL, TSan, and full units pass with zero leaks.