forked from 1b-agent/opencadstudio-upstream
perf(xref): fix O(n²) AcDs parse and skip host re-tessellation
Opening a drawing that xrefs several 3D-heavy DWGs (e.g. Clinic.dwg with 5 discipline files) took ~137s, effectively all of it inside the DWG parser's AcDs SAB blob extraction. Bump the acadrust pin to ceef045, which bounds the AcDs end-marker search so a missing marker family no longer scans the whole buffer per record. Total xref resolve for Clinic.dwg drops from ~97s to ~4s. Also make the post-xref mesh pass incremental: the host solids were already tessellated by the background loader and the merge assigns fresh handles to every imported entity, so `populate_missing_meshes_from_document` keeps the cached host meshes and tessellates only the merged xref solids instead of clearing and rebuilding the whole document. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
cbf454979d
commit
13de968ee9
3 files changed
+37
-7
No files matched your search
@@ -394,10 +394,12 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
|
||||
// built the mesh caches above, so those caches contain none of
|
||||
// the xref'd geometry. The wire pass rebuilds from the document
|
||||
// each frame (bump_geometry covers it), but 3D-solid meshes are
|
||||
// only tessellated by `populate_meshes_from_document` — re-run it
|
||||
// so xref'd solids (walls, floors, roofs) actually render. (#203)
|
||||
// only tessellated by populate — run the incremental variant so
|
||||
// the already-cached host solids are kept and only the newly
|
||||
// merged xref solids (walls, floors, roofs) are tessellated,
|
||||
// avoiding a full re-tessellation of the whole drawing. (#203)
|
||||
if xref_merged {
|
||||
self.tabs[i].scene.populate_meshes_from_document();
|
||||
self.tabs[i].scene.populate_missing_meshes_from_document();
|
||||
}
|
||||
self.tabs[i].scene.selected = rustc_hash::FxHashSet::default();
|
||||
self.tabs[i].scene.preview_wires = vec![];
|
||||
|
||||
Reference in new issue
Block a user