perf(flatten): pre-sized collect/plan and batched entity publish

flatten_plan 2,289 -> 1,098-1,144 us (-50..-52%); flatten_scene_apply 1,213 -> 789-813 us (-33..-35% vs baseline; -28.5% same-session O2-vs-O1, drift-corrected).

Pre-sizes collect/plan vectors and adds Scene::update_entities so FLATTEN issues one geometry bump per batch instead of per entity; single update_entity keeps its exact bump-per-call semantics.
This commit is contained in:
Karim Jerbi committed 2026-09-28 20:29:40 +01:00
1 parent f4dfead9c0
commit fdbbcc419e
3 files changed
+77 -37

No files matched your search

+4 -6
View File
@@ -1146,12 +1146,10 @@ impl OpenCADStudio {
0
} else {
self.push_undo_snapshot(i, "FLATTEN");
let mut moved = 0usize;
for entity in updates {
if self.tabs[i].scene.update_entity(entity) {
moved += 1;
}
}
let moved = crate::modules::draw::modify::flatten::apply_flatten_updates(
&mut self.tabs[i].scene,
updates,
);
if moved == 0 {
self.discard_last_undo_entry(i);
}