Files
magpie/internal
yetone ce6ae593c5 agent: applied.json is parsed once a change for drift
appliedOf is asked for every agent on every drift poll (the GUI asks
/api/drift every 15s while visible), and each ask read and decoded the
whole applied.json. It now goes through filememo.Read: an unchanged file
is parsed once and its map shared (every appliedOf caller only reads it).
appliedSave calls filememo.Look so magpie's own record is read at once,
even inside a held request. Writers (record, appliedLoad's other callers)
still decode a fresh map.

Run (mote, at this tree):
- go test -count=1 ./internal/agent ./internal/filememo: ok (227s)
- go vet ./internal/agent for darwin, linux, windows: clean
- TestAppliedOfParsesAnUnchangedFileOnce: green; with appliedOf put back
  on appliedLoad by hand it is red (25 allocations), restored
- Real accounts (sandbox HOME copy), 40 /api/drift calls, paired runs:
  appliedLoad 2.0/3.1 MB before, gone after; totals 26.1/20.6 MB before,
  18.9/18.2 MB after.

Not tried: Windows and Linux runs of the package (vet only).
2026-11-10 06:19:23 +08:00
..
…
…
…
…
…
…
…
…
…