Several threaded-text paths in threads.rs searched a list once for each
frame, so their work grew with the product of the frame count and the
list length:
- leave_threads (Create Outlines, Expand Appearance, Rasterize, Flatten
Transparency, symbol replacement, opening with text as outlines)
searched the threads for each frame that stayed and ran continued over
that frame's whole thread again, about n^2 frame visits for a thread of
n frames. It now marks each changed thread with one continued call,
and keeps the frames that left in a map instead of a list.
- has_thread_selection (the availability of Release Selection and Remove
Threading), with_threads, keep_shown_text and cut_to_shown, release and
remove test ids against a hash set instead of a list.
- create finds the thread of each selected frame from a table built
once, and each frame still takes in the first thread not yet merged
that lists it.
- release writes each thread back at its own index instead of searching
the thread list for an equal thread.
Marks, thread membership, frame order, text and overflow are unchanged.
A 256-frame thread that loses one frame visited 65,025 frames before
this change and at most 256 now. Six tests on many threads count the set
lookups: with a list in place of the set they make 67,650 to 258,226.
Another test compares the marks with a scan of the frames before each
one.
With repeated names numbered when a brush library is read, a stroke that
names a repeated brush draws the first brush of that name, and a later
brush of the name is read as "Name 2". Three tests built a library with a
repeated name and expected the later brush:
- Document Info lists a name two stored brushes share with the first
brush's type (art), not the last one's.
- The two render memory tests add their own `Dots` scatter brush beside
the default library's `Dots`. They now remove the default `Dots` first,
so the stroke draws their brush.
- The .ai writer test that leaves out a Pattern brush "X" gets the
Calligraphic brush after it back as "X 2", the name it had in the
document.
With the selection as its scope, a fix that removes or unwraps objects
(Needless Groups, Stray Points, Empty Text and the others) kept the list
of selected objects current by searching it and splicing it once for each
object it changed. Removing many selected objects above a long run of
others took time that grew with the square of their number.
The list is now rebuilt in one walk after each pass: each changed object
gives way to what replaces it, in its place, and the others keep their
order. The objects found, the counts, the document and the undo step are
the same as before.
Empty Artboards deleted each empty artboard with its own Vec::remove and
walked every ruler guide again for each one. It now drops the empty
artboards in one walk and deletes their guides in one more. The same
artboards and guides are deleted as before.
Tests cover the order after unwrapping nested and empty groups, Fix All
reaching an unwrapped member on a later round, the rebuild itself, the
number of objects looked at for 150 and 300 removals, and the number of
walks over the artboards and guides when 40 empty artboards are deleted.
`span_at` read the end of a closed subpath's closing segment as past
every stretch, so a click that landed there could leave the path
unchanged. It now reads that place as the first anchor.