diff --git a/Cargo.lock b/Cargo.lock index e211ad0c2683c..74d7e3a1b458c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2376,7 +2376,6 @@ dependencies = [ "oxc_index", "oxc_span", "phf", - "rustc-hash", "serde", "unicode-id-start", ] diff --git a/crates/oxc_allocator/src/hash_map.rs b/crates/oxc_allocator/src/hash_map.rs index d8fac045dca64..f2e1e54af80ba 100644 --- a/crates/oxc_allocator/src/hash_map.rs +++ b/crates/oxc_allocator/src/hash_map.rs @@ -48,6 +48,7 @@ type FxHashMap<'alloc, K, V> = hashbrown::HashMap(ManuallyDrop>); /// SAFETY: Even though `Bump` is not `Sync`, we can make `HashMap` `Sync` if both `K` and `V` diff --git a/crates/oxc_syntax/Cargo.toml b/crates/oxc_syntax/Cargo.toml index dd13330490972..e1a38eb3002c2 100644 --- a/crates/oxc_syntax/Cargo.toml +++ b/crates/oxc_syntax/Cargo.toml @@ -31,7 +31,6 @@ bitflags = { workspace = true } cow-utils = { workspace = true } nonmax = { workspace = true } phf = { workspace = true, features = ["macros"] } -rustc-hash = { workspace = true } unicode-id-start = { workspace = true } dragonbox_ecma = { workspace = true, optional = true } diff --git a/crates/oxc_syntax/src/module_record.rs b/crates/oxc_syntax/src/module_record.rs index 8ff3e99719293..bfd9592169d4f 100644 --- a/crates/oxc_syntax/src/module_record.rs +++ b/crates/oxc_syntax/src/module_record.rs @@ -1,8 +1,6 @@ //! [ECMAScript Module Record](https://tc39.es/ecma262/#sec-abstract-module-records) -use rustc_hash::FxHashMap; - -use oxc_allocator::{Allocator, Vec}; +use oxc_allocator::{Allocator, HashMap, Vec}; use oxc_ast_macros::ast; use oxc_estree::ESTree; use oxc_span::{Atom, Span}; @@ -29,7 +27,7 @@ pub struct ModuleRecord<'a> { /// export ExportFromClause FromClause /// /// Keyed by ModuleSpecifier, valued by all node occurrences - pub requested_modules: FxHashMap, Vec<'a, RequestedModule>>, + pub requested_modules: HashMap<'a, Atom<'a>, Vec<'a, RequestedModule>>, /// `[[ImportEntries]]` /// @@ -57,7 +55,7 @@ pub struct ModuleRecord<'a> { pub star_export_entries: Vec<'a, ExportEntry<'a>>, /// Local exported bindings - pub exported_bindings: FxHashMap, Span>, + pub exported_bindings: HashMap<'a, Atom<'a>, Span>, /// Dynamic import expressions `import(specifier)`. pub dynamic_imports: Vec<'a, DynamicImport>, @@ -71,12 +69,12 @@ impl<'a> ModuleRecord<'a> { pub fn new(allocator: &'a Allocator) -> Self { Self { has_module_syntax: false, - requested_modules: FxHashMap::default(), + requested_modules: HashMap::new_in(allocator), import_entries: Vec::new_in(allocator), local_export_entries: Vec::new_in(allocator), indirect_export_entries: Vec::new_in(allocator), star_export_entries: Vec::new_in(allocator), - exported_bindings: FxHashMap::default(), + exported_bindings: HashMap::new_in(allocator), dynamic_imports: Vec::new_in(allocator), import_metas: Vec::new_in(allocator), } diff --git a/tasks/track_memory_allocations/allocs_parser.snap b/tasks/track_memory_allocations/allocs_parser.snap index dcbb5e1fe1d81..5750771ff34c6 100644 --- a/tasks/track_memory_allocations/allocs_parser.snap +++ b/tasks/track_memory_allocations/allocs_parser.snap @@ -1,14 +1,14 @@ File | File size || Sys allocs | Sys reallocs || Arena allocs | Arena reallocs | Arena bytes ------------------------------------------------------------------------------------------------------------------------------------------- -checker.ts | 2.92 MB || 10161 | 21 || 268665 | 23341 +checker.ts | 2.92 MB || 10157 | 21 || 268665 | 23341 -cal.com.tsx | 1.06 MB || 2213 | 54 || 138188 | 13712 +cal.com.tsx | 1.06 MB || 2197 | 54 || 138188 | 13712 -RadixUIAdoptionSection.jsx | 2.52 kB || 4 | 0 || 365 | 66 +RadixUIAdoptionSection.jsx | 2.52 kB || 1 | 0 || 365 | 66 -pdf.mjs | 567.30 kB || 688 | 71 || 90678 | 8148 +pdf.mjs | 567.30 kB || 683 | 71 || 90678 | 8148 antd.js | 6.69 MB || 6938 | 236 || 528505 | 55357 -binder.ts | 193.08 kB || 540 | 7 || 16807 | 1475 +binder.ts | 193.08 kB || 537 | 7 || 16807 | 1475