Commit Graph
2 Commits
Author SHA1 Message Date
yetone 1f9f74d1c5 provider: the live-model test weighs the same steps on Windows too
TestLiveModelReadWithoutACopy (v0.1.2449) took LiveListed alone as the
cost of a look before the copy. liveByID also asks whether the list is
the provider's and the id it is listed by, which cost more on Windows,
whose stat allocates more: green on macOS, red on Windows ("a look at
one model took 2552 bytes, the list's read 1232"). The baseline now
takes the same steps, and the bar is half a model: the same steps leave
~0 bytes over, a copy 448 and more (on macOS the bar was 16 bytes from
the old code's 1112).

Run on mote and on the Windows box: the test ok -count=10 on each; with
liveByID back on the copying LiveByID it is red 10 of 10 on each. go
vet darwin and windows of internal/provider ok, gofmt -l clean. The
rest of internal/provider on Windows has 14 reds that are the same at
origin/main f9ca3dd44 (keychain, git links, daemon env, two allocation
tests): TestResolveKeptAcrossRequests is #4633, filed now; the
others are #4115, #2808 and #4446.
2026-11-01 03:05:59 +08:00
yetone f9ca3dd44c provider: a look at one model of the vendor's list reads it without a copy
ListedAPIs, the Kilo and Cline free marks, a model's fast tiers and a
remote magpie's price each look up one model of the provider's fetched
list (liveByID), for every model a page lists. Each look copied the
models of that id out of the list read, to read one field. With the
owner's real config the copies were 32 MB of the 2.6 GB a v0.1.2432
magpie allocated over 20 window polls.

catalog.LiveByIDShared is LiveByID without the copy (clipped, so an
append is the caller's own); liveByID uses it, and still copies a model
the user gave its own id, to set that id. Every caller only reads it.

TestLiveModelReadWithoutACopy (a 200-model list, under provider.Hold and
filememo.Hold as a request runs): a look costs less than a model over the
list's read itself, a caller's append doesn't reach the list, and
LiveByID still hands back its own copy. Broken by hand on mote: liveByID
back on LiveByID is red (1112 bytes a look against 520 for the read; a
model is 432).

Run on mote (go test -timeout 45m): internal/catalog ok 0.7s,
internal/provider ok 112s. go vet of both on darwin, windows and linux
ok; gofmt -l clean.
2026-11-01 02:54:20 +08:00