Skip to content

Commit

Permalink
perf(linter): use FxDashMap for module cache (#7522)
Browse files Browse the repository at this point in the history
Same as #7521. Use `FxDashMap` instead of plain `DashMap` for module cache.
  • Loading branch information
overlookmotel committed Nov 28, 2024
1 parent 4a98230 commit 6655345
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/oxc_linter/src/service/module_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ use std::{

use dashmap::{mapref::one::Ref, DashMap};
use oxc_semantic::ModuleRecord;
use rustc_hash::FxHashMap;
use rustc_hash::{FxBuildHasher, FxHashMap};
use std::num::NonZeroUsize;

type FxDashMap<K, V> = DashMap<K, V, FxBuildHasher>;

/// `CacheState` and `CacheStateEntry` are used to fix the problem where
/// there is a brief moment when a concurrent fetch can miss the cache.
///
Expand All @@ -26,7 +28,7 @@ enum CacheStateEntry {
}

/// Keyed by canonicalized path
type ModuleMap = DashMap<Box<Path>, ModuleState>;
type ModuleMap = FxDashMap<Box<Path>, ModuleState>;

#[derive(Clone)]
pub(super) enum ModuleState {
Expand Down

0 comments on commit 6655345

Please sign in to comment.