about summary refs log tree commit diff
path: root/src/libsyntax_pos
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2018-04-23 09:48:08 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2018-04-23 19:15:31 +1000
commitf7d4c976a2b83f3e7119bfc1377b422062187a00 (patch)
treeed278c9171d2eb3b12fd6a7e96a1f353d235a897 /src/libsyntax_pos
parentd2577ca1ec1449bd83d05e540c57447574ccaa28 (diff)
downloadrust-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.rs4
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>,
 }