/api/providers asks archiveState, which asks davsync.S3Bucket and so
Load, on every poll, and Load opened sync.json each time, most often a
file that isn't there. In a profile of 200 lists against a copy of the
owner's real config it was 0.19s of 4.07s.
Load now reads the file's bytes through filememo (once until it
changes, remembered missing while a request holds it) and unmarshals a
Config of its own for each caller. Configure and Restore write through
edit.WriteAtomic, which forgets already; Off removes the file and now
calls filememo.Forget too, so sync turned off in a request is off for
the next Load in it.
Run (on mote unless named):
- go test -count=1 ./internal/davsync ok (36.9s); ./internal/gui red on
TestMainWindowCorners only (macOS 27 on mote, #3949); GOOS=linux and
windows go vet ./internal/davsync ok; gofmt clean (here).
- New TestLoadReadOnceARequest, -count=3 ok: 20 loads in one held
request read once, a caller's change stays its own, and Off is seen
at once. Broken by hand: Load reading the file each time -> "read 20
times, want 1"; no Forget in Off -> "still on after Off".
- Here, 200 GET /api/providers on the sandbox with the real config
copy (offline, proxy :9): davsync.Load 0.19s -> gone from the
profile; total CPU within this machine's noise (4.53s -> 4.62s).
- Then rebased onto 8d8df0639 (nothing in internal/davsync or filememo); not rerun.
Not run: the full ./... suite; a real WebDAV or S3 sync (the write
paths are unchanged).