From 22a482a9f1d73472e646b4a83b55bafd9528f5a3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 29 Oct 2026 20:14:31 -0300 Subject: dump: savePane puts back only the fields it changes, not a copy of the whole 88 KB pane, and makes its empty undo history only for a slim record; the notes say what the small close after a big one measures Co-Authored-By: Claude Opus 5.5 --- docs/next-daemon.md | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'docs') diff --git a/docs/next-daemon.md b/docs/next-daemon.md index 0462c445..0f008974 100644 --- a/docs/next-daemon.md +++ b/docs/next-daemon.md @@ -1529,16 +1529,26 @@ own spread as the A/A): the perf harness's core cells 0.92-0.99 of base | Restore of it | 1845 ms | 310 ms | 0% | | a closed pane kept: the terminal | 131 ms | 143 ms | 4% | | the 100 MB file | 433 ms | 127 ms | 3% | -| a small file, the step after that | 9.6 ms | 17 ms | 44% | +| a small file, after the 100 MB one | 9.6 ms | 17 ms | 44% | | a small file, alone | 1.0 ms | 1.0 ms | 7% | A clean file's text is in the dump now (what makes it complete), and an unsaved one's undo (the 100 MB file's one edit keeps the text before it); -binary, not base64 in ZON, so the rest is faster. A small pane's close -costs what it did: the 17 ms is the 100 MB pane's teardown (panes are -freed two syncs after they close, its undo's text with it) landing in -the next close's time; three small closes after two others take 1 ms in -both builds. The type table is made once a process (it was made at -every store record: 123 µs to 33 µs a small pane's record in Debug). The -live keystroke cells were not run (perf rule: `--live` only for a change -to terminal output); a dump is off the hot path. +binary, not base64 in ZON, so the rest is faster. The small close after +the big one is not the small pane's: it is the kernel freeing the 100 MB +pane's memory on the 9P connection's thread (panes are freed two syncs +after they close), 208 MB against the base's 108, since the restored +unsaved file's undo holds a copy of its text (found with the access +tracer, perf and schedstat, .scratch/daemon/trace). A small close alone +is level (three after two others: 1.0 ms both; an isolated one, median +of ten: base 0.77 ms, new 0.92). Of the 0.15 ms left, two thirds were +outside the walk and are gone: savePane kept the whole 88 KB Pane aside +and put it back, and built a 41 KB empty undo history when it was not +slim; it saves only the fields it changes now. The type table is made +once a process (it was made at every store record: 123 µs to 33 µs a +small pane's record in Debug). ponytail: Store.close's CRC32 over the +record is most of what is left, and a record repeats its 14.6 KB type +table; a table once per store file would shrink both, a change to the +store's format left until a close's cost matters. The live keystroke +cells were not run (perf rule: `--live` only for a change to terminal +output); a dump is off the hot path. -- cgit v1.3