GetYAML, GetYAMLMap and GetYAMLList read the file through filememo,
which kept yaml.v3's whole node tree for as long as magpie runs: ~160
bytes a node behind a pointer, with a tag, styles, comments and places
that no look reads. For dsh's 68 KB settings.yaml, read by RenameLegacy
at start and by dshGet on every poll, plus Hermes' config.yaml, that
tree was the largest thing left in an idle tray's heap. The looks now
keep a yamlLook instead: a node's kind, a scalar's value, and the nodes
under it held inline. GetYAMLText still marshals yaml.v3's tree, so it
keeps one under its own memo kind; only MiniMax's file is read that way.
Run (pushed head's tree, on mica and mote):
- go vet ./internal/edit ./internal/agent; go test ./internal/edit ok;
go test ./internal/agent ok (190s, mica).
- TestYAMLLooksReadAsTheNodeTree holds every key path of a file with
anchors, aliases, merge keys, flow and block lists, complex keys and
comments to what lookupYAML on yaml.v3's tree reads. Broken by hand
(a mapping key copied as its tag, not its value), it goes red.
- Idle tray, real account sandbox with the owner's 25,379 probe lines,
at 150 s, three alternating runs: live heap 9.21 MB (w38, v0.1.3941)
vs 8.39 and 8.41 MB (this); footprint 77 vs 75 and 74 MB.
edit.parseYAMLRoot is gone from the inuse top.
Not tried: Windows or Linux (no OS-specific code here).