perf(bench): introduce standardized 25-metric CAD and UI benchmark suite

- Add comprehensive performance benchmark harness in benches/performance_benchmarks.rs
  configured with harness = false in Cargo.toml (runs via cargo bench in --release,
  isolated from cargo test).
- Benchmark coverage across 25 distinct CAD & UI operations:
  * Entity Ingestion, GPU Wire Partitioning, Analytical & Wide/Tapered Arc Tessellation
  * 100x Zoom Navigation, Spatial InteractionIndex, Multi-mode Hit-Testing, OSnap Tracking
  * 2D Parametric Dogleg Constraint Solving, DXF Import/Export Throughput
  * UI Ribbon View Construction, Viewport Grid Projection, Grid Cache Evaluation
  * Themed SVG Icon Lookup Caching, Cold Extents AABB Calculation
  * Batch Entity Transformation, Draworder Depth Map Full/Patch, Delta-Undo Recording
- Expose internal calculation hooks with #[doc(hidden)] pub to prevent API leakage.
- Remove 644 lines of legacy, scattered ad-hoc #[test] #[ignore] benchmarks across src/.
- Add developer and regression documentation in benches/README.md.
This commit is contained in:
Karim Jerbi committed 2026-09-12 13:46:01 +01:00
1 parent 754cc89fab
commit 58c9fcb748
9 files changed
+1786 -651

No files matched your search

-82
View File
@@ -78,85 +78,3 @@ impl SelectionState {
}
}
#[cfg(test)]
mod bench_selection_clone_tests {
use super::SelectionState;
use iced::Point;
use std::hint::black_box;
use std::sync::Arc;
use std::time::Instant;
fn make_state(poly_len: usize) -> SelectionState {
let mut s = SelectionState {
vp_size: (1920.0, 1080.0),
poly_points: vec![Point::new(10.0, 10.0); poly_len],
..Default::default()
};
s.box_anchor = Some(Point::new(0.0, 0.0));
s.box_current = Some(Point::new(100.0, 100.0));
s
}
#[test]
#[ignore]
fn bench_selection_state_clone() {
let state = make_state(64);
for _ in 0..20 {
black_box(state.clone());
}
let n = 5000u32;
let start = Instant::now();
for _ in 0..n {
black_box(state.clone());
}
let elapsed = start.elapsed();
let per = elapsed / n;
println!(
"SelectionState::clone (deep, 64 pts): {:?} per clone (n={}, total {:?})",
per, n, elapsed
);
assert!(per.as_secs_f64() > 0.0);
}
#[test]
#[ignore]
fn bench_selection_arc_clone() {
let state = Arc::new(make_state(64));
for _ in 0..20 {
black_box(Arc::clone(&state));
}
let n = 5000u32;
let start = Instant::now();
for _ in 0..n {
black_box(Arc::clone(&state));
}
let elapsed = start.elapsed();
let per = elapsed / n;
println!(
"Arc<SelectionState>::clone (Arc bump, 64 pts): {:?} per clone (n={}, total {:?})",
per, n, elapsed
);
assert!(per.as_secs_f64() > 0.0);
}
#[test]
#[ignore]
fn bench_selection_state_clone_empty() {
let state = make_state(0);
for _ in 0..20 {
black_box(state.clone());
}
let n = 5000u32;
let start = Instant::now();
for _ in 0..n {
black_box(state.clone());
}
let elapsed = start.elapsed();
let per = elapsed / n;
println!(
"SelectionState::clone (deep, 0 pts): {:?} per clone (n={}, total {:?})",
per, n, elapsed
);
assert!(per.as_secs_f64() > 0.0);
}
}