mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
perf(linter): use FxDashMap for module cache (#7522)
Same as #7521. Use `FxDashMap` instead of plain `DashMap` for module cache.
This commit is contained in:
parent
4a98230f07
commit
6655345bb9
1 changed files with 4 additions and 2 deletions
|
|
@ -5,9 +5,11 @@ use std::{
|
||||||
|
|
||||||
use dashmap::{mapref::one::Ref, DashMap};
|
use dashmap::{mapref::one::Ref, DashMap};
|
||||||
use oxc_semantic::ModuleRecord;
|
use oxc_semantic::ModuleRecord;
|
||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::{FxBuildHasher, FxHashMap};
|
||||||
use std::num::NonZeroUsize;
|
use std::num::NonZeroUsize;
|
||||||
|
|
||||||
|
type FxDashMap<K, V> = DashMap<K, V, FxBuildHasher>;
|
||||||
|
|
||||||
/// `CacheState` and `CacheStateEntry` are used to fix the problem where
|
/// `CacheState` and `CacheStateEntry` are used to fix the problem where
|
||||||
/// there is a brief moment when a concurrent fetch can miss the cache.
|
/// there is a brief moment when a concurrent fetch can miss the cache.
|
||||||
///
|
///
|
||||||
|
|
@ -26,7 +28,7 @@ enum CacheStateEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Keyed by canonicalized path
|
/// Keyed by canonicalized path
|
||||||
type ModuleMap = DashMap<Box<Path>, ModuleState>;
|
type ModuleMap = FxDashMap<Box<Path>, ModuleState>;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(super) enum ModuleState {
|
pub(super) enum ModuleState {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue