Commit Graph
1 Commits
Author SHA1 Message Date
yetone 4c331696ec gui: an overview is summed once per stats and filters
The Sessions page asks /api/sessions/overview on every poll, and each
ask summed every session again (Stats.Overview: days, shapes, tool and
skill use, the top sessions) and encoded it, to the same answer while the
stats stood. The answer is now kept, encoded, by statsForGen's gen (it
moves only when the stats do) and the filters, the last 8 of them; the
Codex top rows' model and effort are added again only when
CodexModelEffort hands back another map (the map itself is held, so a
new one can't take the old one's address).

Measured on mote with the owner's real account copy (network blocked),
30 asks of /api/sessions/overview: 0.92s of CPU on v0.1.3435's tree,
0.24s with this (~31 ms -> ~8 ms an ask).

Run on mote: go vet + go test ./internal/gui, ok. TestOverviewSummed-
OncePerStats is red with the kept answer ignored by hand ("two asks of
the same stats summed 2 times, want 1").
Not tried: the GUI suite; the answer's bytes are json.Marshal plus a
newline, as the Encoder wrote them.
2026-11-10 01:17:43 +08:00