perf(hash): swap std HashMap/HashSet for rustc-hash FxHash
Phase 4.1. Handle / u64 keys dominate the hot maps (block_defn, hatch / image / mesh caches, draw-depth map, viewport wire caches); the default SipHash is wasted work on integer keys. Alias the std types to rustc_hash::FxHashMap / FxHashSet crate-wide so every map and set — including the cross-module draw-depth map shared between scene and the GPU pipelines — uses the faster hasher consistently. Mechanical: no behavioural change. Constructors moved from ::new() to ::default() (Fx variants carry no RandomState). Build + 13 tests green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3098523b8d
commit
70702d063f
30 changed files with 102 additions and 98 deletions
|
|
@ -7,7 +7,7 @@
|
|||
//! • Linetype → read-only for now
|
||||
//! • Geometry → text_input per coordinate / dimension field
|
||||
|
||||
use std::collections::HashMap;
|
||||
use rustc_hash::FxHashMap as HashMap;
|
||||
use std::fmt;
|
||||
|
||||
use crate::ui::ROW_H;
|
||||
|
|
@ -142,12 +142,12 @@ impl Default for PropertiesPanel {
|
|||
selected_group: None,
|
||||
linetype_items: vec![],
|
||||
selection_group_combo: combo_box::State::new(vec![]),
|
||||
choice_combos: HashMap::new(),
|
||||
choice_combos: HashMap::default(),
|
||||
layer_combo: combo_box::State::new(vec![]),
|
||||
lineweight_combo: combo_box::State::new(lw_options()),
|
||||
linetype_combo: combo_box::State::new(vec![]),
|
||||
hatch_pattern_combo: combo_box::State::new(crate::scene::hatch_patterns::names()),
|
||||
edit_buf: HashMap::new(),
|
||||
edit_buf: HashMap::default(),
|
||||
color_picker_open: false,
|
||||
color_palette_open: false,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
//
|
||||
// Dropdown items within a group are collected into columns of 3 rows.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use rustc_hash::FxHashMap as HashMap;
|
||||
|
||||
use acadrust::types::{Color as AcadColor, LineWeight};
|
||||
use iced::widget::{button, column, container, mouse_area, row, scrollable, svg, text};
|
||||
|
|
@ -73,7 +73,7 @@ impl Ribbon {
|
|||
wireframe: false,
|
||||
ortho_mode: true,
|
||||
open_dropdown: None,
|
||||
last_cmd: HashMap::new(),
|
||||
last_cmd: HashMap::default(),
|
||||
layer_names: vec!["0".to_string()],
|
||||
active_layer: "0".to_string(),
|
||||
layer_infos: vec![LayerInfo {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Shared rendering helpers, button styles, colours, layout constants, and
|
||||
// free functions used by the Ribbon view/overlay methods.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use rustc_hash::FxHashMap as HashMap;
|
||||
use std::time::Duration;
|
||||
|
||||
use acadrust::types::{Color as AcadColor, LineWeight};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
//! A checked row means that type can be picked; unchecking it excludes the
|
||||
//! type from interactive selection. Opened from the FILTER status pill.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use rustc_hash::FxHashSet as HashSet;
|
||||
|
||||
use iced::widget::{button, column, container, mouse_area, row, text};
|
||||
use iced::{Background, Border, Color, Element, Fill, Length, Padding, Theme};
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ fn section<'a>(title: &'static str) -> Element<'a, Message> {
|
|||
}
|
||||
|
||||
pub fn view_window<'a>(
|
||||
overrides: &'a std::collections::HashMap<String, String>,
|
||||
overrides: &'a rustc_hash::FxHashMap<String, String>,
|
||||
) -> Element<'a, Message> {
|
||||
// ── Toolbar ───────────────────────────────────────────────────────────
|
||||
let toolbar = container(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
//! adds or removes that pill from the bar. The choice is persisted so it
|
||||
//! survives across sessions.
|
||||
|
||||
use std::collections::HashSet;
|
||||
use rustc_hash::FxHashSet as HashSet;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Identifies a toggleable status-bar pill.
|
||||
|
|
@ -121,7 +121,7 @@ pub struct StatusBarConfig {
|
|||
impl StatusBarConfig {
|
||||
/// Load the saved customization, or all-visible when none exists.
|
||||
pub fn load() -> Self {
|
||||
let mut hidden = HashSet::new();
|
||||
let mut hidden = HashSet::default();
|
||||
if let Some(path) = config_path() {
|
||||
if let Ok(body) = std::fs::read_to_string(path) {
|
||||
for line in body.lines() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue