perf(scene): route hide / isolate-end / solid-register through bump_entities (phase 5)

hide_selected, end_isolation and register_solid_model called bump_geometry() —
a full-drawing invalidation (clears the tessellation memos, bumps block_epoch) —
even though each touches a known, bounded set of handles. On a large drawing
hiding a few objects then re-tessellated everything still visible.

Report the exact changed handles via bump_entities instead: hide/reveal mark
just the affected entities Modified so the resident set drops or re-adds only
those, and register_solid_model reports its one solid (also making a bulk
register loop O(n) rather than O(n^2)). No block-definition changes are
involved, so skipping block_epoch is correct.

Deliberately left on the full path: layer freeze/off (block sub-entity layer
visibility legitimately needs block_epoch), viewport-scale (annotation-key
sensitive), isolate (already cheap — keeps few), and undo/redo/style/file-open.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-15 08:11:21 +03:00
1 parent 9a86a7394c
commit e914be9852
1 file changed
+13 -3
+13 -3
View File
@@ -1421,7 +1421,10 @@ impl Scene {
self.meshes.insert(handle, set);
}
self.solid_models.insert(handle, solid);
self.bump_geometry();
// Only this solid's mesh changed — report just its handle so the mesh /
// wire caches patch it in rather than rebuilding the whole drawing (and
// so a bulk register loop stays O(n), not O(n²)).
self.bump_entities(&[(handle, ChangeKind::Modified)]);
}
/// `BACKGROUND` change picks up the new `adapt_to_bg` result without
@@ -2366,7 +2369,11 @@ impl Scene {
}
self.set_invisible(&sel, true);
self.selected.clear();
self.bump_geometry();
// Only the hidden entities changed visibility — report just those so the
// resident set drops them instead of re-tessellating the whole drawing.
let changes: Vec<(Handle, ChangeKind)> =
sel.iter().map(|&h| (h, ChangeKind::Modified)).collect();
self.bump_entities(&changes);
}
/// Clear isolation — bring every hidden entity back (End Isolation),
@@ -2378,7 +2385,10 @@ impl Scene {
let restore: Vec<Handle> = self.hidden.iter().copied().collect();
self.set_invisible(&restore, false);
self.hidden.clear();
self.bump_geometry();
// Re-reveal just the previously hidden entities (bounded to that set).
let changes: Vec<(Handle, ChangeKind)> =
restore.iter().map(|&h| (h, ChangeKind::Modified)).collect();
self.bump_entities(&changes);
}
/// Set the persisted visibility flag (DXF code 60) on each handle.