From 6655345bb9f0ae597017be8fb074b9a244d9c3b3 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:32:43 +0000 Subject: [PATCH] perf(linter): use `FxDashMap` for module cache (#7522) Same as #7521. Use `FxDashMap` instead of plain `DashMap` for module cache. --- crates/oxc_linter/src/service/module_cache.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/oxc_linter/src/service/module_cache.rs b/crates/oxc_linter/src/service/module_cache.rs index b46b2ff30552f..3bb4196c5f75e 100644 --- a/crates/oxc_linter/src/service/module_cache.rs +++ b/crates/oxc_linter/src/service/module_cache.rs @@ -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 = DashMap; + /// `CacheState` and `CacheStateEntry` are used to fix the problem where /// there is a brief moment when a concurrent fetch can miss the cache. /// @@ -26,7 +28,7 @@ enum CacheStateEntry { } /// Keyed by canonicalized path -type ModuleMap = DashMap, ModuleState>; +type ModuleMap = FxDashMap, ModuleState>; #[derive(Clone)] pub(super) enum ModuleState {