mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-26 02:59:17 -06:00
Everything derived from the catalog was keyed on its revision, which every op raises. So each edit (a keyword, a rating, every tick of a slider) had the grid's list queried and sorted again from every photo, the source counted by a second full query, and the side panels tally the whole library again. In a library of 67,000 photos the frame after one keyword took about 156 ms with both side panels open (an idle frame: 2 ms). The catalog now remembers which photos its latest ops touched and what of them they changed (`Catalog::touched_since`, `aspects_since`, `Aspects`). It answers "not known" for an op that changes more than photos of its own (an album, a stack, the keyword list), for changes too long ago, and for a revision it did not make itself (a library just loaded). - The view (`Session::visible`): when the same view is asked again after a small edit, the photos the edit touched are taken out of the list it had, asked about again, and put back at their place in the order (`Catalog::follow`). 37 ms -> 0.6 ms. Worked out whole as before: more than 256 photos touched, a change that is not photos' own, an album in its own order, Recently Added, Missing Photos, and a view that asks about "the last N days" (it changes with the clock too). - The source's count: taken from the list when no filter is set, else counted without sorting (`Catalog::count`). 37 ms -> 0. - The side panels (`Caches`): the folder tree, keyword tree, date groups, people's names and library counts are kept through an edit that changed nothing they read. A rating or a slider changes none; a keyword leaves the folders, dates and counts. The frame after a keyword: about 156 ms -> 54 ms with both side panels open, 71 ms -> 2 ms with the grid alone (`tests_view_cost.rs`, a synthetic library, run with --ignored --nocapture). Still paid on each edit: the count beside every album and smart album in the left panel (about 25 ms for a smart album there), and the filter bar's lists. Tests: 1,440 random edits of every photo-local kind across sources, sorts, filters and the hold, each compared with the list worked out whole; 600 random edits comparing every kept tally with a fresh one; the clock; the record itself, with its failure paths. `ui.inspect` -> `perf` reports `viewFollowed` and `viewWorkedOut`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>