forked from 1b-agent/opencadstudio-upstream
perf(plotstyle): extract and speed up layer-usage table rebuild
view_window() rebuilt the 256-bucket ACI layer-usage table inline on every modal view: unconditional 256-Vec allocation plus sort_by_key (lowercase key recomputed per comparison). Extract pure build_layer_usage(), build it only when the CTB path needs it (STB path now allocates nothing), and sort with sort_by_cached_key while skipping trivial buckets. Tests: - build_layer_usage_buckets_index_colors: ACI bucketing + case-insensitive order - build_layer_usage_ignores_non_index_colors: truecolor layers excluded Bench (cargo bench ui_plotstyle_layer_usage, 200 layers): ~13us median, PASS. A/B vs pre-change inline code: ~15.7us -> ~12-13us (~22% faster).
This commit is contained in:
1 parent
768ce2ca82
commit
70d7e9a31f
3 files changed
+141
-18
No files matched your search
+2
-1
@@ -19,7 +19,7 @@ cargo bench --bench performance_benchmarks -- --quick
|
||||
|
||||
---
|
||||
|
||||
## Benchmark Suite Catalog (25 Metrics)
|
||||
## Benchmark Suite Catalog (26 Metrics)
|
||||
|
||||
### 1. Scene & Entity Management
|
||||
- `scene_entity_ingestion_10k`: Ingestion throughput for 10,000 mixed 2D entities (Lines, Circles, Arcs, Polylines).
|
||||
@@ -51,6 +51,7 @@ cargo bench --bench performance_benchmarks -- --quick
|
||||
- `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).
|
||||
|
||||
### 6. State Management & Draworder
|
||||
- `selection_state_deep_clone`: Deep cloning of `SelectionState` (with 64 polygon points).
|
||||
|
||||
Reference in new issue
Block a user