mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-18 11:14:13 +00:00
Add Used Colors and New Color Group link the selected art's paints to global swatches through Document::map_solid_paints_in, which drops each id that sits inside another listed id. It searched the whole id list for each ancestor of each id, so the work grew with the square of the selection. It now looks each ancestor up in a set of the ids, as without_inner in crates/engine/src/cmd/edit.rs does. The roots keep the order of the list, duplicates and ids missing from the document, so the same paints are linked in the same order. - mapping_within_ids_matches_a_search_of_the_ids compares the count, the paints visited and the resulting document with the search for every list of up to three ids from a nested tree (nested ids in both orders, duplicates, a missing id and an empty list). - crates/engine/examples/link_colors_bench.rs times both ways in one process. With 20,000 selected rectangles the call takes 16 ms of CPU time instead of 128 ms; with 2,000 it takes 1.4 ms instead of 2.5 ms.