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%.
This commit is contained in:
Nicholas Nethercote 2018-04-23 09:48:08 +10:00
parent d2577ca1ec
commit f7d4c976a2

View File

@ -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>,
}