The window asks /api/drift every 15s. On the owner's live magpie a heap
profile showed Drift and Values allocating ~3.3 GB in 37 minutes, most
of it DeepSeek Harness: settings.yaml (80 KB) parsed again for each
field GetYAML read (465 MB of it), and each profile entry's YAML parsed
again on each of dshCheck's looks (dshHomeHas, dshOver, dshConfigIndex,
dshRoutesIn, dshConfig).
- edit.loadYAML memoizes the parsed root through filememo, keyed by the
file's stat, and shares it with GetYAML, GetYAMLMap, GetYAMLList and
GetYAMLText, which only read it. Writes go through their own parse as
before. BlockList skips the decode for a text that starts as a block
list (blockSequence), which every dsh patch list does.
- dshNodeShared parses an entry's text once and shares the node with the
read-only lookers (dshConfig, dshConfigIndex, dshRoutesIn, dshOver's
patch side). The writers (dshOver's base, the route and start writes)
keep dshNode's own copy. 512 entries kept at most.
Run on mote (macOS 27.2):
- Probe on copies of the owner's real ~/.dsh (settings.yaml, config.yaml,
the desktop and web profiles; probe not committed, copies deleted):
a.Values() + a.Drift() per poll, 20 polls: 16381 KB / 223788 allocs
per poll with the edit change alone -> 4355 KB / 2588 allocs.
- TestGetYAMLParsesTheFileOnce (new): a look at a 3000-entry file
allocates under a tenth of its size; sees SetYAML, another process's
write, a removed file and a list-topped file.
TestBlockSequenceAgreesWithADecode (new): ~24 texts against yaml's own
decode.
- TestDshLookParsesAnEntryOnce (new): with dshConfig and dshConfigIndex
put back on dshNode by hand: "27388 allocations, want a few", red.
Restored: ok. It also checks a writer's change never shows in a look.
- go test ./internal/agent ./internal/edit: ok (164.2s, 5.9s).
go vet both: ok. gofmt -l: clean.
Not tried: the full suite (only internal/agent and internal/edit
call these); a live window poll after the release.