Commit Graph
1 Commits
Author SHA1 Message Date
yetone c8095d1101 usage: pages of 131k rows or more pair one at a time (#2278)
On a cold start the Usage page's requests (All) and heatmap (a year),
and the warm-up's Codex effort, each paired the whole history side by
side, and the live heap reached 624–630 MB at ~10–12 s: the peak. Now
a page's build, or Codex effort's pairing, of bigBuildRows (1<<17) rows
or more holds bigBuilds; a smaller page, Today's, goes beside them, and
its IO never waits (TestQueryPageIOOutsideCacheLock passes). Nothing
under the gate takes requestCache's lock or waits on a flight.

Measured on mote (M5 Pro), cold start with no caches, 390k calls,
a growing Codex rollout, 10 endpoints polled every 5 s, 60 s each:
- before (v0.1.2113): phys_footprint_peak 794 / 783 MB, CPU
  2:01.55 / 2:01.12
- after: 610 / 646 MB, CPU 2:01.08 / 2:03.22
- the first round's slowest usage answers, before 7.9 / 10.3 s and
  7.9 / 10.3 s, after 7.9 / 11.5 s and 6.4 / 8.7 s
On v0.1.2111 plus the warm-up fix alone, the gate cut the max live heap
from 624/630 to 473/480 MB but not the peak, which the request file's
write then set (8e1b1b26d).

Tests at this head, through mote-run:
- go vet -tags nogui ./..., GOOS linux, windows and darwin: ok
- go test -count=1 -timeout 45m ./internal/usage/ ./internal/gui/
  ./internal/sessions/: usage, sessions ok; gui only
  TestMainWindowCorners/macOS_26_SDK, #3949.
- TestBigPagesPairInTurn (two big pages, a 200 ms pairing each): 1 at
  once; with bigBuildRows at 1<<40 it was red, 2 at once.
2026-10-30 06:48:56 +08:00