Repository navigation
Undo of a large erase: the resident wire patch tells that it has to decline before it tessellates the objects - #3471
Merged
HakanSeven12 merged 2 commits intoNov 23, 2026
Conversation
Erasing most of a drawing has the resident set built again without the erased entities. Undoing the erase then brings them back as new entities between the ones that stayed; new runs only go in at the tail, so the patch declines. The test asks for it to tell before it tessellates them, since the full build tessellates them again. `resident_patch_tessellated` counts the entities a patch tessellates. The patch tessellates all 360 before it declines: the test fails. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Undoing an erase of 100,000 objects spent 0.6 s in a patch of the resident wire set that then declined. Erasing that much has the set built again without the erased entities, so the undo brings them back as new entities between the ones that stayed. A new run only goes in at the tail, and the patch found that out when it placed the first of them: after it had looked up and tessellated all of them and copied their runs. The full build then tessellated them again. Before that work the patch now looks for a new entity that the order update will list before a run the patch leaves alone. Such an entity declines the patch unless it is hidden or draws nothing, so that one entity is tessellated to tell. Up to four candidates are looked at; after that the patch goes on as before. The usual add, whose key comes after every listed one, is passed over with one comparison. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How it shows up
Refs #3231 ("lag ... at times more than a few seconds" when working on groups in large files). There is no file there, so this is a synthetic drawing of 100,800 objects (14,400 cells of five lines, a circle and a text). Select the 100,440 in view, ERASE, then Undo: the objects take 3 seconds to come back. Six tenths of a second of that are a patch of the resident wire set that does not go in:
Cause
Erasing more than half of the set has it built again without the erased entities (
too-many-tombstones). The undo then brings them back as entities the set has no slots for, between the 360 that stayed. A new run only goes in at the tail, sotry_resident_patchdeclines and the full build takes over.It found that out when it placed the first new run, which is after it had looked up and tessellated all 100,440 entities and copied their runs for the GPU patch. The full build then tessellates them again: their memo entries are pending ones, which count as a miss.
The change (
src/scene/resident_wires.rs)Before it looks up and tessellates the changed entities, the patch now asks whether one of the new ones is bound to decline it:
new-run-not-at-the-tail.DECLINE_PROBES); after that the patch goes on as it did, and still declines at the placement if it has to.tessellate_entityis called through one closure by this check and by the parallel pass.Scene::resident_patch_tessellatedcounts the entities a patch tessellates, next toresident_patch_hits, for the test.What the patch does when it goes in is unchanged, and so is the set the full build makes after a declined one.
Measured
Release builds, Windows 11, RTX 3070, Direct3D 12,
PERF=1.mainis 0ca0345 with the lock file of #3459 so that it builds. "Frame" isnav-prepare elapsed, from the command to the prepared frame. Two runs of each build.mainresident-patch-attempt, declinedwires-build)resident-patch-attemptresident-patch-attemptThe last two rows are patches that go in: the check adds nothing that shows.
The same view captured after each step of a sequence in both builds (MOVE of everything, its undo, ERASE of everything, its undo, MOVE of scattered objects, its undo: 11 captures). The drawing is the same pixel for pixel in all of them; one capture has the pointer's crosshair over the canvas in one build and not in the other.
mainTests (
src/scene/resident_patch_adds_tests.rs)a_patch_that_cannot_place_its_new_entities_declines_before_tessellating_them: 400 lines, all but each tenth erased (the set is built again with the 40 that stay) and restored. The patch must not go in, must tessellate at most four entities, and the set must draw the whole drawing again. Fails on the first commit:the declined patch tessellated 360 of the 360 entities before the full build.cargo test --lib scene::resident_patch_adds_tests scene::journal_tests: 41 passed.cargo test --workspace --no-fail-fast, with the lock file of Cargo.lock: gpu-allocator is back on thewindowscrate wgpu-hal uses, somainbuilds on Windows #3459: 7,755 passed, 2 failed, 49 ignored. Neither failure is about this change:app::control::spellcheck::tests::speller_survives_com_unload_reload_cyclesfails the same way onmainon this machine;app::command_driver::tests::bedit_characterization_tests::picklocked_off_makes_locked_layer_objects_unselectablepasses alone, three runs of three, and its module passes, 16 of 16. It readsPICK_LOCKED, one flag for the process, while other tests set it; it failed the same way in a whole run ofmainwith that lock file (see Cargo.lock: gpu-allocator is back on thewindowscrate wgpu-hal uses, somainbuilds on Windows #3459).cargo check --target wasm32-unknown-unknown --libpasses.Limits
maindoes until Cargo.lock: gpu-allocator is back on thewindowscrate wgpu-hal uses, somainbuilds on Windows #3459 is in.draw-depth-patch), which Undo of an erase: each restored object's draw depth is found at its handle's place, not by walking the order #3469 is about, 150 ms in the full wire build and 110 ms in the command.OCS
mainat 0ca0345, Windows 11.🤖 Generated with Claude Code