Skip to content

Commit

Permalink
perf: use FxHashMap instead of HashMap.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Jul 9, 2024
1 parent 0994094 commit 2c039c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions parser-ng/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
indexmap = { workspace = true }
itertools = { workspace = true }
rustc-hash = { workspace = true }
logos = "0.14.0"
rowan = "0.15.15"

Expand Down
4 changes: 2 additions & 2 deletions parser-ng/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ error nodes is valid YARA code.

use indexmap::map::Entry;
use indexmap::{IndexMap, IndexSet};
use std::collections::HashMap;
use rustc_hash::FxHashMap;

pub mod cst;

Expand Down Expand Up @@ -116,7 +116,7 @@ struct InternalParser<'src> {
/// the position of `c`. When `expect(b)` fails later, the parser looks up
/// any other token (besides `b`) that were expected to match at the
/// position and produces a comprehensive error message.
expected_token_errors: HashMap<Span, IndexSet<&'static str>>,
expected_token_errors: FxHashMap<Span, IndexSet<&'static str>>,

/// Errors that are not yet sent to the `output` stream. The purpose of
/// this map is removing duplicate messages for the same code span. In
Expand Down

0 comments on commit 2c039c6

Please sign in to comment.