Files
magpie/internal
yetone 7f2acb9ffa gui: a first start's page asks and warm-up reads take turns (#2278)
On a first start with no sums on disk, the window asks the Sessions
page's stats and overview and the Usage page's requests and heatmap
while the warm-up reads the same history. A heap profile at a live
294 MB, 30.6 s in, had ~147 MB in those asks' handlers (QueryPage 102
MB, session stats 51 MB) beside ~42 MB in the warm-up's session scan.
Each was a first read of the history held beside the others.

Until the warm-up ends, each warm-up step and each ask of /api/sessions,
/api/sessions/stats, /api/sessions/overview, /api/usage,
/api/usage/requests and /api/usage/heatmap take one turn at a time
(coldTurns). Each read comes after the one before it has kept what it
read, so most find it kept. held's sessions.Ask still makes the
warm-up read at full speed while a page waits. No page waits more than
2 minutes for its turn, so a stuck warm-up can't hold the pages. Once
the warm-up is over, nothing waits. Tests don't take turns
(coldTurnsTaken).

Bench on mote (M5 Pro), a real 390k-call history, cold (no caches),
poll.sh asking what an open window asks every 5 s, the poll loop killed
between runs (advgcp2.sh); phys_footprint peak:
  before (bca0d6d69): 456 494 500 469 424 424 416 410 MB
  after:              392 396 394 404 389 393 392 MB
  live heap max: ~293-338 before, ~276-288 after
  slowest requests/heatmap answer: 31-46 s before, 30-39 s after;
  every poll answered 200 in the last three runs (100 of 100)

Also tried and not shipped: reading the warm-up's 0 and 30 day session
stats in one pass, with asks for a range being read waiting for it. Its
peaks were 408 480 463 405 MB against 424 424 416 410 MB.

Run at bca0d6d69, rebased onto c59c547c5, whose two commits touch no
file here (claudetui, gateway, provider, and app.js/i18n.js strings):
- go vet ./internal/gui (darwin) and GOOS=windows: clean.
- go test -count=1 ./internal/gui on mote: ok except
  TestCoveredWindowStaysUp, a real AppKit window killed at its 30 s
  deadline. That is #4125: mote's AppKit tests hang.
- go test -race -count=3 of TestColdTurnsTaken, TestWarmUp*, TestStats*,
  SessionStats, Overview, Heatmap: ok.
- Broken by hand: with coldTurn's turn skipped, TestColdTurnsTaken fails
  with "the page was answered while the warm-up's step read".
Not run: Linux go vet. Cross-compiling needs cgo for Wails, and the WSL
distro has no gtk4 or webkitgtk-6.0 dev packages. The change has no
OS-specific code.
2026-10-31 06:22:53 +08:00
..
…
…
…
…