Skip to content

Commit f7d4c97

Browse files
committed
Use FxHashMap in syntax_pos::symbol::Interner::intern.
Because it's faster than HashMap. This change reduces the time taken for a few of the rustc-perf benchmarks, mostly the small ones, by up to 5%.
1 parent d2577ca commit f7d4c97

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libsyntax_pos/symbol.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
use hygiene::SyntaxContext;
1616
use {Span, DUMMY_SP, GLOBALS};
1717

18+
use rustc_data_structures::fx::FxHashMap;
1819
use serialize::{Decodable, Decoder, Encodable, Encoder};
19-
use std::collections::HashMap;
2020
use std::fmt;
2121
use std::hash::{Hash, Hasher};
2222

@@ -184,7 +184,7 @@ impl<T: ::std::ops::Deref<Target=str>> PartialEq<T> for Symbol {
184184

185185
#[derive(Default)]
186186
pub struct Interner {
187-
names: HashMap<Box<str>, Symbol>,
187+
names: FxHashMap<Box<str>, Symbol>,
188188
strings: Vec<Box<str>>,
189189
gensyms: Vec<Symbol>,
190190
}

0 commit comments

Comments
 (0)