Files
magpie/internal/edit
yetone 5a48a4251c edit: a TOML file's kept table names share one buffer (#2278)
TOMLTables' answer is kept for as long as magpie runs (tomlAnswers),
and Codex's config.toml names a table for every project it trusted,
~11k on a long history. setNames cloned each name on its own: one
allocation a name, rounded up to its size class, all scanned by every
GC. They are now copied into one buffer and sliced from it; they still
hold nothing of the file's text.

Measured on mote, 11k names like projects."/Users/…/p-N", HeapAlloc
and HeapObjects kept, separate processes, twice each:
  before: 841,680 B, 10,994 objects
  after:  ~715,000 B, 2 objects
-15% bytes, 11k fewer objects for the GC to scan.

Run on mote: gofmt -l, go vet ./internal/edit, go test ./internal/edit
(TestKeptNamesArePacked: names equal, none points into the source
text, packing takes 2 allocations, nil stays nil).
2026-11-13 15:18:39 +08:00
..