On a cold start the page of the month, the page of All, Codex's effort
and the heatmap read the history side by side and pair it in turn
(holdBigBuild). Each one missed the pairing the one before had kept
(pairMemo), and paired the whole history again beside it. On the real
history (469 gateway blocks, 16619 session chunks) every big build
missed; the warm All page's miss had a memo whose session serials all
differed (16619 of 16619).
Three things kept them apart:
- A session file's chunk got a serial from a counter each time a read
built it. The builds read the same files together and share one build
of each (sharedBuild), but each named its copy apart. A chunk's
serial is now made from what it is made of: the file's path, size
and mtime under the index's root and meta (sourceSerial), the same
in a build and in a chunk read back from requests-v1.bin. The top
bit keeps it apart from a counted serial (gateway blocks, other
computers' days). The caches keyed by serial (cells, fold ids, match
hints, message keys) hold what a chunk's rows give, so a chunk of
the same file and meta reads the same from them.
- A build took the last pairing when it began, before waiting its
turn. It now takes it once it has the turn (lastPairs).
- A build kept its pairing after it let the turn go, so the build
that waited took its turn first and found none. It now keeps it
while still holding the turn (keepPairsFor). The memo is kept
though the build's index isn't: it stands only for chunks of its
serials.
TestBigBuildsBegunTogetherPairOnce starts the page of All and the
heatmap together over a gateway log and eight session files, both
having read their rows before either pairs: two pairings, every row
once and the heatmap's recent days.
Broken by hand, the test is red (3 pairings) with any one of the three
undone: the counted serial back, the memo taken before the turn, the
memo not kept.
Run at this head, rebased on e31ccf230, on mote: go test -timeout 45m
./internal/usage/ (ok 16.3s; 52.9s at 2f65a33aa) and ./internal/usageapi/ (ok); gofmt -l
clean; GOOS=linux, windows and darwin go vet ./internal/usage/
./internal/usageapi/ ok. ./internal/gui/ was run at 2f65a33aa: the AppKit
real-window tests (TestMainWindowCorners, TestPanelCloseHidesIt, the
Dock and tray ones) hit their 20-80s deadlines on mote, which has no
window session for them (#4125, #2645); nothing in the GUI changed.
GOOS=linux go vet ./internal/gui/ stops in Wails' cgo files, as a cross
build without cgo does.
On mote, the real history, a true cold start (caches deleted), 240 s
polled as the Usage page polls: phys_footprint_peak 551, 553, 548 MB
against v0.1.2213's 607 (592-628 in earlier runs), CPU 3:50-4:08 against
3:40, under load ~27 from other sessions. An instrumented build logs
one pairing of All, then hits for the rest (30d, then All miss, All
hit, All hit). A restart with the caches kept: 317 MB against 341, CPU
10.5 s against 10.5 s. The peak left is Codex's effort pairing All
(~150 MB) while the page of the month, under bigBuildRows, pairs its
own beside it (~80 MB); not changed here.