From f7d4c976a2b83f3e7119bfc1377b422062187a00 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 23 Apr 2018 09:48:08 +1000 Subject: [PATCH] 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%. --- src/libsyntax_pos/symbol.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 50fac600a978d..b449c5eea6658 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> PartialEq for Symbol { #[derive(Default)] pub struct Interner { - names: HashMap, Symbol>, + names: FxHashMap, Symbol>, strings: Vec>, gensyms: Vec, }