Skip to content

perf(core): cheaper JSON byte accounting - #73

Closed
chh-ay wants to merge 2 commits into
bench/evidence-protocolfrom
perf/core-gaps
Closed

chh-ay wants to merge 2 commits into
bench/evidence-protocolfrom
perf/core-gaps

Conversation

@chh-ay

@chh-ay chh-ay commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Scope

A regression check of 0.5.0 against 0.4.x, plus one measured core optimization. Part of #59. Stacked on #72 (base bench/evidence-protocol).

Regression check

Matched 10-round render capture on the current harness, 7f73dc7 (0.5.0 stack) against fac48bd (0.4.x). The committed render baseline could not be used: it pins older harness sources and an older runner, and #72 re-records it in the release capture.

  • No regression above A/A noise. The one strict-gate flag, arrow-right.middle (+5.8%, 99% lower bound +0.004 ms), did not reproduce in a 10-round attribution run at ≥250 ms per sample (+1.5% against an A/A spread of −7.0% to +5.7%). Rolling back the row-number clipping fix (b54b29a) did not change it.
  • Editing scenarios lean slower but stay inside noise one by one: edit-open +3.0% to +11%, edit-commit +9.1%. scroll-right −14.7%, altering.remove-5-rows −9.5%.

Change

perf(core): JSON byte accounting (transaction admission) counts plain ASCII runs together, sizes finite numbers with String() instead of JSON.stringify, and checks own toJSON with Object.hasOwn. Byte counts, limits, and invalid-input errors are unchanged.

Workload Before After Change
Clear + undo of 500,000 cells 935.9 ms 868.9 ms −7.2%
CSV import (untouched) 447.2 ms 448.6 ms +0.3%
Packed setBlock admission (untouched) 977.9 ms 985.2 ms +0.7%

A/A control: 9 rounds, noise band ±4.6%. ABBA: 9 rounds; every round improved by 5.3%–9.3%. Outputs are identical. A faster XLSX attribute scanner was rejected (−1.7%, inside noise).

Verification

  • Build, docs:check, api:check, typecheck, lint pass; packages 869 pass / 6 skip / 0 fail; Rust 147 / 223 pass.
  • WASM binaries are unchanged by this layer (TypeScript only).

Batch bounded ASCII runs and avoid JSON serialization and descriptor allocation for finite numbers and own-property checks. This reduces large-clear undo by 7.16% outside the 4.62% A/A band, while CSV import and packed admission remain within 1%.
@chh-ay

chh-ay commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

Landed on develop in the 0.5.0 release squash: #112 (55cfa82).

@chh-ay chh-ay closed this Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant