mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-28 12:08:10 -06:00
Cause: the sidebar's Keywords section drew every keyword row on every frame (layout, text measuring, widget registration, hover text, context menu), even the thousands out of sight, and every catalog edit rebuilt the keyword tree from all photos with several String allocations per keyword level. On a 58,000-photo library with 4,000 keywords an unchanged frame took 7.4 ms in the sidebar alone and the frame after a rating 220 ms (156 ms of it the tree), release build on Apple Silicon. Fix: - Keywords rows out of sight only take their height (open children are still walked, so the layout is unchanged), as the grid already does (#35). A keyword made from the header's + is always drawn and the sidebar scrolls to it, so it is in sight even at the end of a long list. - Catalog::keyword_tree works out each distinct keyword string's levels once and then only counts (a per-level "last photo" stamp replaces the per-photo HashSet of Strings). Now: 0.55 ms per unchanged frame (7 rows drawn instead of 4,000), keyword_tree 17 ms, the frame after a rating 44 ms. Test: tests_keyword_sidebar::keywords_section_draws_only_the_rows_near_ the_screen (failed before: "2000 of 2000 keyword rows drawn"; now the rows near the screen, and scrolling reaches the last keyword), an ignored timing probe at the report's library size, a catalog test for a keyword repeated on one photo, and the_keywords_header_creates_a_keyword now checks the new keyword is in sight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>