Commit Graph
4 Commits
Author SHA1 Message Date
dotCooCoo 9a58807841 Performance: a move finds the selected objects' places in fewer walks of the tree
With 10,000 objects selected, object.move walked the document's tree five
times and looked each object up by id three times. It now walks the tree
three times and looks each object up once.

- The selected roots (for the menus, for Move, Rotate, Scale and the
  other transforms, for Copy and Cut, and inside an isolated group) are
  put in paint order and reduced to their top-level objects from one walk
  instead of two.
- A transform finds the objects' places once for Transform Patterns and
  for the edit, instead of once for each.
- After a transform, the check for a pixel-aligned compound path reads
  the parent at the object's place instead of looking the object and its
  parent up by id.
2026-11-29 16:44:27 -08:00
dotCooCoo 0ab10f3935 Selection: the selected roots are found once for each selection
selected_roots put the selected objects in paint order and dropped the
inner ones, two walks of the document, every time a command or an
enabled check asked. A rebuild of the menus asks many times for one
selection. The roots are now kept on the thread with the document
version (held weakly, so its address is not reused) and the selected
objects, and found again only when either changes.

With 10,000 rectangles selected, a menu rebuild after Select All went
from about 500 ms to about 340 ms on the build host.
2026-11-28 15:00:04 -08:00
BFlat 3f7620e00b test: compare the cut tests' documents without their creation stamps (#8836) 2026-11-20 21:11:52 +07:00
dotCooCoo 385b4c5e82 Cut: direct-selection Cut removes whole and emptied paths in one pass per parent
Cut with direct-selected anchors or segments removed each object selected
whole, and each path it left with no segment, with its own remove. Every
removal shifted the siblings after it, so later lookups walked the
document's tree again. With 2,000 roots removed whole, the old loop
walked the tree 10,005 times.

These removals now go through the same batch that already places the
surviving pieces, which rebuilds the children of each layer or group
once, and compound paths left with no members are removed after it. A
compound path left with one member stays a compound path. The document,
the selection, the clipboard and the undo step are the same as before.

With 2,000 of 10,000 squares on one layer selected whole and two anchors
of another picked, Cut walks the tree 8 times instead of 10,005 and
takes a median of 11 ms of CPU time instead of 573 ms (release build on
Linux, seven alternating runs in one process).
2026-11-17 17:49:21 -08:00