forked from 1b-agent/opencadstudio-upstream
The operations docs/automation/API-SPEC.md (PR #1383) describes, brought over from huaninstratech/OpenCADStudio so the specification no longer runs ahead of the code: - entity CRUD: entities_create, entities_delete, entities_transform, entities_copy_to, and `where` filters on query - blocks and export: block_define, block_delete, a normalised wblock - publishing: layout_create, page_setup_set, plot (per_page included) - metadata: sysvar, xdata_set / xdata_get, file_identity - collections: group_create, selection_set_save / load - control plane: batch, events, view_focus, close - the REST transport: `--http <port>`, the /api/v1 routes and their OpenAPI 3 description - person-in-the-loop picks: user_select and getpoint, hosted by the GUI over the same REST routes, with on-screen pending signals Taken from the fork's commits b7a7ed80, 69396b42, 64f1cf6a, c3aafc8e, bb5a7bfa, 52317a5c, 50d293ba, b90e194f, 517c6397, 53a5c4c9, a49ac045, 37de5a46, a78b1822, 6d9aed2a, 33f522da, 5b5cafe2, 02a7e78d, 94df40dc, fd5bc14d, 485fac61 and 2c5fc994. Left out on purpose: 37de5a46 also removed the donation surface (the Patreon fetch, the donation prompt, the Start-page supporters rail, the DONATE command and its locale strings) and replaced the About dialog's call to action; that is the fork's own product decision and stays out. The fork's version bump and its unrelated IFC/BIM work are not part of this. Adapted while porting: the REST server and the GUI bridge are desktop-only and a template start is refused in the web build, so the wasm target still compiles; the two plot tests read the PDF through the shared stream helper, because exported streams are Flate-compressed; the benches set the new crosshair field; comments and docs describe each operation in its own terms rather than by another product's API names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenCADStudio Performance Benchmarks
A standardized, statistical performance benchmarking suite measuring throughput, latency, and memory metrics across core CAD subsystems and the user interface.
Quick Start
Run the full benchmark suite with native --release optimizations:
cargo bench
Run a fast validation smoke test (~2 seconds):
cargo bench --bench performance_benchmarks -- --quick
Note
Benchmarks are registered under
[[bench]]withharness = false. They are never executed by regularcargo testruns, preventing CI slowdowns.
Benchmark Suite Catalog (31 Metrics)
1. Scene & Entity Management
scene_entity_ingestion_10k: Ingestion throughput for 10,000 mixed 2D entities (Lines, Circles, Arcs, Polylines).batch_entity_transform_mutation: Translating 1,000 entities, invokingbump_entities, and updating the spatial acceleration structure.undo_delta_recording_cycle: Capturing before-images and transactional delta recordings for 500 entity mutations.
2. Geometry Tessellation & Viewport Navigation
analytical_curved_tessellation: Initial wire generation for 14,000 curved entities (circles, arcs, ellipses, polylines).wire_partitioning_per_frame: Partitioning 14,000 wires into GPU analytical instances vs regular lines.analytical_curved_zoom_100x: 100 camera zoom navigations measuring frame overhead and FPS.wide_and_tapered_arc_tessellation: Tessellating 7,500 thick polyline arcs, tapered arcs, and donuts.zoom_extents_bounding_box_calc: Cold axis-aligned bounding box (AABB) calculation across 20,000 mixed entities (ZOOM EXTENTS).
3. Spatial Indexing, Snapping & Picking
spatial_interaction_index_build: Building the spatialInteractionIndexandprepare_screenfor 10,000 wires.hit_test_click_pick_latency: Single-point cursor click selection across 5,000 entities in screen space.hit_test_box_window_enclosed: Window selection (box_hitenclosed) across 5,000 entities.hit_test_box_crossing_boundary: Crossing selection (box_hitcrossing boundary) across 5,000 entities.osnap_cursor_tracking_latency: Real-time cursor snapping across Endpoint, Midpoint, Center, Intersection, and Nearest modes.
4. Parametrics & DXF I/O
constraint_solver_dogleg_system: Solving coupled 2D geometric constraints (Perpendicular, Parallel, Length) via the Dogleg solver.dxf_export_write_throughput: Serializing 5,000 entities to DXF binary stream.dxf_import_parse_throughput: Parsing DXF stream of 5,000 entities intoCadDocument.
5. UI & Viewport Overlay Performance
ui_ribbon_view_construction: Per-frame ribbon widget tree construction.ui_grid_geometry_uncached: Multi-pane tiled viewport grid projection and segment generation.ui_grid_cache_hit_evaluation: Grid overlay cache key construction and reuse decision.ui_icon_handle_cached: Themed SVG icon cache hit (FxHashMap lookup + Handle clone).ui_icon_handle_uncached: Uncached SVG icon memory parse and Handle allocation.ui_plotstyle_layer_usage: Plot Style 256-bucket ACI layer-usage table rebuild (200 layers).ui_statusbar_derived_data: Status-bar cached derived-data hit (layout names + scale pickerArcclones).ui_grip_budget: Budgeted per-frame selection-grip projection (dense-polyline grips capped toMAX_SELECTED_GRIPS).ui_grip_budget_build: Selection-changeapply_grip_budgetcost over the full grip set (sort + FxHashSet + filter).ui_constraint_glyphs: Constraint-glyph cache hit (cached_glyph_placementskey build +Arcclone over dozens of glyphs, no recompute).ui_selection_overlay: Selection overlay Element construction (widget tree with capped grip count, no canvas draw).
6. State Management & Draworder
selection_state_deep_clone: Deep cloning ofSelectionState(with 64 polygon points).selection_state_arc_clone:Arc<SelectionState>::clone(atomic reference bump).draworder_depth_map_full_build: Full draworder depth map generation across 10,000 ordered entities.draworder_depth_map_incremental_patch: Fast-path incremental depth map patch on entity modification.
Filtering Benchmarks
Filter execution by subsystem or name pattern:
# Filter by UI
cargo bench --bench performance_benchmarks -- ui
# Filter by tessellation
cargo bench --bench performance_benchmarks -- tessellation
# Filter by hit testing
cargo bench --bench performance_benchmarks -- hit_test
Baseline Tracking & Regression Detection
1. Save Current Metrics as Baseline
cargo bench --bench performance_benchmarks -- --output target/baseline_metrics.json
2. Compare PR / Branch Against Baseline
cargo bench --bench performance_benchmarks -- --baseline target/baseline_metrics.json
The benchmark runner will output statistical deltas (% faster / % slower) for each metric and flag regressions exceeding the defined thresholds.