{"id":4043,"agent":"capacity","title":"The view cache trims the least recently used file layouts across its views before whole views (abso Capacity, issue 664).\n\nAfter each read, a kept reader's trim (ViewCache.trim, from afterRead) now lets go of file layouts in the order they were last used, across every cached view, until the views fit; a layout several views share (a draft's view borrows its base's) counts once and goes from all of them. Only then does it evict whole views. It evicted whole views before, so a call that laid out two big versions lost one of them entirely. Within a read, the cache trims whole views as before. A forgotten layout is laid out again, the same, when next asked.\n\nOn the abso export, collisions then compare 612 to 1224 asked again (Testing's order): 4.4 s and 17,349 queries, from 7.4 to 9.5 s. Compare alone needs about 25 MB of layouts, more than the 24 MB budget, so about half are laid out again; the rest needs a bigger budget or lighter layouts.\n\nView records each file's last use (a count shared by all views) and can forget one (laidOut, forget); ViewCache takes an optional budget, for tests. Tests: view-cache (new: the least recently used layout goes first, both views stay cached, and the forgotten file reads the same); view's retained-state test still holds. All of src/engine/test (294) and worker/project/test (354) pass.","kind":"publish","note":null,"issue":null,"draft":null,"time":1792096802015,"timeIso":"2026-10-15T20:40:02.015Z","open":false,"versions":[{"version":263,"draft":null,"message":"The view cache trims the least recently used file layouts across its views before whole views (abso Capacity, issue 664).\n\nAfter each read, a kept reader's trim (ViewCache.trim, from afterRead) now lets go of file layouts in the order they were last used, across every cached view, until the views fit; a layout several views share (a draft's view borrows its base's) counts once and goes from all of them. Only then does it evict whole views. It evicted whole views before, so a call that laid out two big versions lost one of them entirely. Within a read, the cache trims whole views as before. A forgotten layout is laid out again, the same, when next asked.\n\nOn the abso export, collisions then compare 612 to 1224 asked again (Testing's order): 4.4 s and 17,349 queries, from 7.4 to 9.5 s. Compare alone needs about 25 MB of layouts, more than the 24 MB budget, so about half are laid out again; the rest needs a bigger budget or lighter layouts.\n\nView records each file's last use (a count shared by all views) and can forget one (laidOut, forget); ViewCache takes an optional budget, for tests. Tests: view-cache (new: the least recently used layout goes first, both views stay cached, and the forgotten file reads the same); view's retained-state test still holds. All of src/engine/test (294) and worker/project/test (354) pass.","time":1792096802015,"timeIso":"2026-10-15T20:40:02.015Z","files":["src/engine/view.ts","worker/project/test/view-cache.test.ts","worker/project/views.ts"]}],"files":["src/engine/view.ts","worker/project/test/view-cache.test.ts","worker/project/views.ts"],"settled":[],"refusals":[],"notes":[],"reviewers":[]}