Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(linter): use FxDashMap for module cache #7522

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading