Files
magpie/internal
yetone 0e7d2391ce sessions: the list of call files is sized once, not grown a file at a time
callFilesWith appended each of ~20k session files (a ~200-byte struct)
to a slice grown from nothing, on every Sessions and stats read: every
15 s poll of the window. It now gathers each source's list first and
makes the slice and the seen map at their total.

Measured on a copy of the owner's real history (rss-home: real
~/.claude/projects and ~/.codex sessions), warm start, then 12 GUI-like
poll cycles 15 s apart (api/state, api/sessions, stats?days=30,
api/usage, requests today, quotas, providers), origin/main a3d4f8c5c
against this tree with the next commit's effort gap: allocation over
the polls 4668 MB -> 3879 MB; callFilesWith's 1167 MB -> 342 MB (its
append growth, 984 MB flat, is gone). Footprint 241-336 MB against
256-296 MB, the same within noise.

Run at this tree: go test ./internal/usage/ ./internal/sessions/ ok;
./internal/cli ./internal/davsync ./internal/gui ./internal/middleware
./internal/otlp ./internal/tui ./internal/tune ./internal/usageapi ok;
gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui of usage
and sessions ok. Not run: internal/agent and internal/gateway, which
don't read this list's order or size.
2026-10-27 07:46:32 +08:00
..
…
…
…