mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 09:36:45 +00:00
Cut Path at Selected Anchor Points cleared the selection and then added each cut path in turn, and each add searched the paths already added, so selecting the cut ends took time that grows with the square of the number of cut paths. The command now selects them with one Selection::set call, which skips repeats through a hash set and keeps the order in which each path first appears, and then adds each cut end's anchor. The selection is the same in every field; a new test compares it with the one-by-one build on open, closed and multi-subpath cuts, long lists and an empty list. The gain shows on large documents. With the 8 middle anchors of each of 5,000 open paths of 10 anchors selected, building the selection of 40,000 cut ends takes 9.7 ms instead of 232 ms of CPU time, and with 2,000 paths 3.2 ms instead of 39 ms (medians of 7 runs of the new cut_path_select_bench example, both ways in one process).