forked from 1b-agent/opencadstudio-upstream
Scene.selection was Rc<RefCell<SelectionState>> (31 fields, ~1.6KB with poly_points) cloned deep per view_main per pane via (*sel_ref).clone() at view/mod.rs:760. Replace with Arc<RefCell<SelectionState>> (Arc::new(RefCell::new(...)) at scene/mod.rs:1436,1868), SelectionCanvas holds Arc<RefCell> and selection_overlay takes Arc<RefCell> (overlay.rs:365,415), view_main does Arc::clone(&tab.scene.selection) (atomic bump) instead of deep clone. sel_ref stays borrowed for field reads (vp_size etc.). Bench (release, n=5000): SelectionState::clone 39-68ns (64pts) / 11-22ns (0pts) vs Arc::clone 7ns — 5-9x on the hot path. Tests: - selection_is_arc_not_refcell: asserts type_name contains Arc - bench_selection_state_clone / bench_selection_arc_clone / bench_selection_state_clone_empty (ignored, release)