perf(render): don't duplicate the wire set when no Face3D wire exists

The per-epoch Face3D/other split cloned every wire into two owned lists
even when the face3d list came out empty — for pure 2-D drawings and
mesh imports (#358) the 'other' list was a wire-for-wire copy of the
entire base set, held resident in split_cache alongside the original.

Cache None as an 'everything is other' marker and hand the render the
base set itself for that frame. The base Arc is deliberately not stored
in the cache: try_resident_patch can only apply an incremental patch
while the resident Arc is uniquely held, so pinning it there would
silently degrade every edit to a full rebuild.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Kevin GriffinandClaude Fable 5 committed 2026-07-22 13:03:01 -07:00
1 parent 5aecdff12e
commit e9198a47e5
2 files changed
+33 -14

No files matched your search

+7 -1
View File
@@ -1061,9 +1061,15 @@ pub struct Scene {
/// [`WIRE_CONTENT_GEN`] id. `split_face3d_wires` is an O(N) per-wire
/// handle lookup + clone that otherwise re-runs every frame. A map, not a
/// slot: a paper frame walks several sources (sheet + viewports).
///
/// `None` for the second element means "no Face3D wire in this set — use
/// the base set itself". The base `Arc` is deliberately NOT stored here:
/// `try_resident_patch` can only move a resident set out for an
/// incremental patch while its `Arc` is uniquely held, so pinning it in
/// this cache would silently force a full rebuild on every edit (#358).
#[allow(clippy::type_complexity)]
split_cache:
RefCell<HashMap<u64, (Arc<Vec<WireModel>>, Arc<Vec<WireModel>>)>>,
RefCell<HashMap<u64, (Arc<Vec<WireModel>>, Option<Arc<Vec<WireModel>>>)>>,
/// Cached `selected ∪ hover` handle set for the GPU xray overlay, keyed by
/// `selection_generation`. Rebuilt only when the selection changes so
/// `build_primitive` doesn't clone the set every frame.