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
|
|
@ -63,7 +63,7 @@ pub struct SnapResult {
|
|||
|
||||
// ── Snapper ───────────────────────────────────────────────────────────────
|
||||
|
||||
use std::collections::HashSet;
|
||||
use rustc_hash::FxHashSet as HashSet;
|
||||
|
||||
pub struct Snapper {
|
||||
/// Global snap on/off toggle. When false, all snapping is bypassed
|
||||
|
|
@ -87,7 +87,7 @@ pub struct Snapper {
|
|||
|
||||
impl Default for Snapper {
|
||||
fn default() -> Self {
|
||||
let mut enabled = HashSet::new();
|
||||
let mut enabled = HashSet::default();
|
||||
enabled.insert(SnapType::Endpoint);
|
||||
enabled.insert(SnapType::Midpoint);
|
||||
enabled.insert(SnapType::Center);
|
||||
|
|
@ -257,7 +257,7 @@ impl Snapper {
|
|||
let tmp = Snapper {
|
||||
snap_enabled: true,
|
||||
enabled: {
|
||||
let mut s = HashSet::new();
|
||||
let mut s = HashSet::default();
|
||||
s.insert(SnapType::Tangent);
|
||||
s
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue