Pad/internal
Greg Pomerantz 3c8017f871 editor: split oversized chunks on insert (bound per-edit copy cost)
The chunked buffer was the right structure for this workload, but the
implementation let the edited chunk grow without bound (the type comment
even admitted 'not rebalanced'): sustained typing at one spot made that
chunk grow monotonically, so each subsequent insert copied the whole
grown chunk -- quadratic total copy work for sustained typing.

Insert now splits any chunk that grows past 2x the target size in half,
and the empty-buffer path chunks a large first paste directly instead of
creating one oversized chunk. The per-edit copy cost is now bounded by
O(chunkSize) by construction. The split cut is an arbitrary byte offset
(like SetContent boundaries): chunk edges may fall inside multi-byte
sequences, which is fine because readers reassemble whole line-aligned
windows from chunk bytes.

Shrunken/empty chunks from deletes are left in place: chunk count never
grows with deletes, all readers walk actual lengths, and removal would be
pure churn with no reader-side benefit.

No behavior change visible to readers (Content/FullContent/LineIndex all
walk actual chunk lengths); covered by three new tests: sustained-typing
chunk-size invariant + content, large paste into empty buffer, and
content integrity across newly created split boundaries. Full suite green
under -race.
2026-08-16 22:36:15 -04:00
..
browser chore: remove per-event debug logging from the normal path 2026-08-16 20:58:49 -04:00
editor editor: split oversized chunks on insert (bound per-edit copy cost) 2026-08-16 22:36:15 -04:00
io/pool Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
perf perf: default-off in-app profiler + debug scroll jumps; verify scroll perf & clamping 2026-08-16 16:53:28 -04:00
test/e2e Make state single-owner and stabilize race detector 2026-08-16 01:32:27 -04:00
ui chore: remove per-event debug logging from the normal path 2026-08-16 20:58:49 -04:00