forked from 1b-agent/opencadstudio-upstream
perf(blocks): keep repeated block copies as one stub wire each
Every further reference to an already expanded block (a translated copy of the same definition, at the top level or nested) was materialised as a full copy of every wire, although the GPU already draws those copies from one shared source with a per-copy offset. Such a copy is now a single stub wire holding the shared prototype and its offset (stubs nest inside prototypes, so nested repeats collapse too). - The block renderer expands stubs into instance references while it groups by source, so drawing is unchanged. - Interaction queries expand only the stubs near the query, so snapping, picking, window and crossing selection see each copy's geometry. - Plot, boundary detection, viewport projection and entity_wires() get fully expanded wires; count and reference-edit recolouring expand the set while they are active. - OCS_NO_BLOCK_STUBS turns it off. A drawing with 480 references to a block of 100 nested 50-line blocks (2.4M lines) now opens with 11k wires instead of 2.4M: peak memory 5.4 GB -> 0.37 GB, wire assembly 2.4 s -> 36 ms, interaction index 3.7 s -> 23 ms. The viewport, a plotted PDF, snaps and selections are identical with and without stubs, and on five real drawings the view renders the same. Refs #1698, #1542 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d287decd8
commit
29c0d1df9a
14 files changed
+445
-52
No files matched your search
@@ -386,6 +386,7 @@ pub fn apply_along(
|
||||
fill_is_3d: false,
|
||||
fill_is_2d_solid: false,
|
||||
render_instance: None,
|
||||
stub: None,
|
||||
pick_tris: Vec::new(),
|
||||
pick_tris_low: Vec::new(),
|
||||
dash_from_start: false,
|
||||
|
||||
Reference in new issue
Block a user