diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-04-23 09:48:08 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2018-04-23 19:15:31 +1000 |
| commit | f7d4c976a2b83f3e7119bfc1377b422062187a00 (patch) | |
| tree | ed278c9171d2eb3b12fd6a7e96a1f353d235a897 /src/libsyntax_pos | |
| parent | d2577ca1ec1449bd83d05e540c57447574ccaa28 (diff) | |
| download | rust-f7d4c976a2b83f3e7119bfc1377b422062187a00.tar.gz rust-f7d4c976a2b83f3e7119bfc1377b422062187a00.zip | |
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%.
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 50fac600a97..b449c5eea66 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -15,8 +15,8 @@ use hygiene::SyntaxContext; use {Span, DUMMY_SP, GLOBALS}; +use rustc_data_structures::fx::FxHashMap; use serialize::{Decodable, Decoder, Encodable, Encoder}; -use std::collections::HashMap; use std::fmt; use std::hash::{Hash, Hasher}; @@ -184,7 +184,7 @@ impl<T: ::std::ops::Deref<Target=str>> PartialEq<T> for Symbol { #[derive(Default)] pub struct Interner { - names: HashMap<Box<str>, Symbol>, + names: FxHashMap<Box<str>, Symbol>, strings: Vec<Box<str>>, gensyms: Vec<Symbol>, } |
