Red on ubuntu CI at 4a9cfb52e (run 41865226839) and on the Linux box
alone: "listing 3000 unchanged files took 12159 allocations", bar 3n =
9000.
Cause: dirent.Stats reads a folder's stats in one call on macOS
(getattrlistbulk) and has no such call elsewhere, so on Linux statFiles
stats each file alone through statOne (os.Stat), two allocations a
file: 6000 for the test's 3000 files. The names are kept the same on
both systems. A probe of the second listing (not committed) gave Linux
12115 allocations, 6110 with statOne answered without allocating, and
macOS 6128 and 6124; one os.Stat is 2 allocations on each. The 3n bar
was set on macOS and charged Linux's stats to the names.
Change (test only): the measured listing's statOne is answered from a
table of os.Stat read before it, so what is counted is the listing's
own work on every system. The bar is unchanged.
What was run, at this tree on origin/main fd85c0a1e:
- Linux (wsl-run, magpie-desktop, go1.26.8, -tags nogui): the old
test red, 12159 allocations. The new test ok. The new test with
ccNames.of never taking the last listing's names (broken by hand):
red, 12159.
- macOS (mote): the new test ok; with the names broken by hand red,
12198.
- go test -count=3 ./internal/sessions: ok on Linux (-tags nogui) and
macOS. gofmt -l clean; go vet, GOOS=linux go vet -tags nogui,
GOOS=windows go vet of internal/sessions: clean.
Not tried: Windows (no bulk stat there either, so it would have been
red the same way; Windows CI only compiles tests).
Not changed: Linux still pays os.Stat's two allocations a session file
each poll; that cost is the system's stat, not this test's guarantee.