Skip to content

Commit 03b36e5

Browse files
committed
perf: use rustc-hash
1 parent cc62f24 commit 03b36e5

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ wasm = ["serde_json", "dprint-core/wasm"]
2525
tracing = ["dprint-core/tracing"]
2626

2727
[dependencies]
28-
dprint-core = { version = "0.46.3", features = ["formatting"] }
29-
fnv = "1.0.7"
28+
dprint-core = { version = "0.46.4", features = ["formatting"] }
29+
rustc-hash = "1.1.0"
3030
serde = { version = "1.0.118", features = ["derive"] }
3131
serde_json = { version = "1.0", optional = true }
3232
swc_ast_view = { version = "0.36.0", package = "dprint-swc-ecma-ast-view" }

src/parsing/context.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use dprint_core::formatting::{ConditionReference, Info};
2-
use fnv::{FnvHashMap, FnvHashSet};
2+
use rustc_hash::FxHashMap;
3+
use rustc_hash::FxHashSet;
34
use swc_ast_view::*;
45

56
use super::*;
@@ -14,9 +15,9 @@ pub struct Context<'a> {
1415
pub token_finder: TokenFinder<'a>,
1516
pub current_node: Node<'a>,
1617
pub parent_stack: Stack<Node<'a>>,
17-
handled_comments: FnvHashSet<BytePos>,
18-
stored_infos: FnvHashMap<(BytePos, BytePos), Info>,
19-
stored_info_ranges: FnvHashMap<(BytePos, BytePos), (Info, Info)>,
18+
handled_comments: FxHashSet<BytePos>,
19+
stored_infos: FxHashMap<(BytePos, BytePos), Info>,
20+
stored_info_ranges: FxHashMap<(BytePos, BytePos), (Info, Info)>,
2021
pub end_statement_or_member_infos: Stack<Info>,
2122
before_comments_start_info_stack: Stack<(Span, Info)>,
2223
if_stmt_last_brace_condition_ref: Option<ConditionReference>,
@@ -36,9 +37,9 @@ impl<'a> Context<'a> {
3637
token_finder: TokenFinder::new(module),
3738
current_node,
3839
parent_stack: Stack::new(),
39-
handled_comments: FnvHashSet::default(),
40-
stored_infos: FnvHashMap::default(),
41-
stored_info_ranges: FnvHashMap::default(),
40+
handled_comments: FxHashSet::default(),
41+
stored_infos: FxHashMap::default(),
42+
stored_info_ranges: FxHashMap::default(),
4243
end_statement_or_member_infos: Stack::new(),
4344
before_comments_start_info_stack: Stack::new(),
4445
if_stmt_last_brace_condition_ref: None,

0 commit comments

Comments
 (0)