mirror of
https://github.com/storytold/filmcraft.git
synced 2026-10-24 10:10:05 -06:00
Writer::add rejected a duplicate name by comparing the new name with every sibling through compare_names, which allocates two Vec<u16> per call, so n children in one storage cost O(n^2) allocating comparisons. An AAF export puts every marker and component in one storage: 20 000 markers took 58 s, 20 000 clips 56 s, 20 000 connected clips 87 s and 100 000 markers never finished (an FCPXML of 1 MB is enough). Doubling the input quadrupled the time; every other exporter stayed linear. Each storage keeps a set of its children's names as sibling order compares them (UTF-16 code units, upper-cased), so the duplicate check is a hash lookup. Same result: case-insensitive, also beyond ASCII, per storage. 20 000 markers now export to AAF in 0.38 s, 100 000 in 2.0 s, 20 000 clips in 0.23 s and 20 000 connected clips in 0.45 s. Tests: adding 40 000 children must take under 3 s (0.02 s now, 21 s before) and the duplicate rules are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>