Stats.Overview copied every Summary (~400 bytes) into its working slice,
then cloned that slice once per Top ranking. Over 34k sessions the
Sessions page's poll allocated ~1.5 GB in two minutes this way while an
agent worked (alloc profile of v0.1.1928 on mote: `in = append` 958 MB,
slices.Clone 557 MB). It now ranks pointers into st.Sessions and copies
only the k sessions each ranking keeps. shapes, toolUse and skillUse take
the pointers.
TestOverviewCopiesOnlyItsTop: a second Overview over 5000 sessions
allocates at most half of their Summaries' size, and its count and
rankings are what they were. Red on the old code (14,923,144 bytes over a
1,020,000 bar), green on the new.
A/B on mote (34,040 session files, 240k-row usage.jsonl, the feed run
of run2278c.sh: 230s, feed from 60s, Usage and Sessions pages polled),
v0.1.1928 code vs this change. mote's load was 47 to 66 from other runs
throughout, so the numbers are noisy:
avg CPU after the feed starts 122.8% -> 69.4%
heatmap poll mean 6.97s -> 4.84s
all polls mean 3.11s -> 2.16s
footprint peak 685.6M -> 626.1M
footprint at the end 402.8M -> 337.5M
Run on mote, at base b5d2858f4:
go test -count=1 -timeout 45m ./internal/sessions/ ./internal/usage/
ok (30.9s, 18.0s)
go test ./internal/gui/: FAIL only in TestMainWindowCorners, the open
macOS 27 red #3949
Rebased onto origin/main 7a7931833 (no change to internal/sessions), and
run again at the pushed head on mote:
go test -count=1 -timeout 45m ./internal/sessions/ ./internal/usage/
ok (16.8s, 16.1s)
GOOS=linux/windows/darwin go vet -tags nogui ./internal/sessions/
./internal/usage/ ./internal/gui/ ok