mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-13 22:21:59 +00:00
Clear, path.deleteAnchors, Cut, Copy and Cut Path scanned every selected anchor or segment of a path once for each of its subpaths, so a path with thousands of subpaths took time that grew with the square of their count. The selection sets are ordered by subpath, so a new helper, subpath_refs, reads one subpath's entries with a range lookup instead. The results are unchanged. With one selected interior anchor on each of 8,000 open subpaths of one path, Clear took a median of 74 ms of thread CPU time before and 3 ms after (release build, five runs each; the timings are noisy because the CPU was shared and loaded). Tests in delete_path_pieces.rs check exact surviving subpaths and their order for anchor and segment selections across open and closed subpaths, an untouched subpath, references to missing subpaths and indexes, one Undo/Redo step and a second Clear, and Cut Path on several subpaths.