mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 10:46:46 +00:00
Select > Same, Select by Color (select.color) and document.find looked up the parent of every object they checked by its id, through Document::parent_of and Document::node, to tell members of a compound path and faces of a Live Paint group from other objects. The walk already stands on that parent, so it now hands it to the check with the object. walk_selectable keeps its signature and visits the same objects in the same order. The selected objects, their order and the count reply are the same as before, and so is the Reselect state of Select > Same. Tests compare the walk and the parents it hands out with the old walk and Document::parent_of, and the results of six Same commands and select.color with the old per-id loop, in four isolation scopes, from rectangles at the top level, in a group and in a sublayer, compound path members, Live Paint faces and a compound path. In a damaged document that holds an id twice, the parent read is the one that holds the object being checked. The gain shows on large documents. With 220,482 objects, the search of Select > Same > Fill Color takes a median of 24 ms of CPU time instead of 83 ms, and of Stroke Color 22 ms instead of 60 ms (release build on Linux, seven alternating runs of both loops in one process; an ignored test, select_same_perf, times them).