heatBefore summed the recent chunks' rows before the cut for heatSplit,
pageSplit and effortSplit, unpacking every recent chunk whole each time.
A long-lived session file is recent for weeks (one of the owner's Claude
sessions holds 57k calls), so each recompute of the Usage page while an
agent works unpacked ~200k rows three times. A named chunk's sum is now
kept by its serial and the cut, and dropped after hintsKept reads that
didn't ask for it, as hintsOf keeps a chunk's hints.
Run on mote at this tree:
- go test ./internal/usage ./internal/usageapi: ok
- GOOS=linux|windows|darwin go vet -tags nogui ./internal/usage: ok
- TestHeatBeforeKeptBySerial: sums equal a count of every chunk, a named
chunk is unpacked once per cut, an unnamed one every time.
Broken by hand (a kept sum used whatever its cut): red; restored, green.
- A debug build on a copy of the real history logged each call: the
first reads of a start (concurrent) unpacked 766 non-empty chunks
(207k rows) each; the next read unpacked none of them.
- Cold start bench, 120s of polls: fp_peak 321MB vs 309MB before, 103 vs
96 GCs: no change outside noise, since polls answered 304 recompute
nothing. A bench appending a call every 3s was too noisy on mote
(load ~20 from other work) to show a difference either way.
Not tried: the GUI suite (no GUI file changed).