summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2016-11-08 14:02:55 +1100
committerNicholas Nethercote <nnethercote@mozilla.com>2016-11-08 15:14:59 +1100
commit00e48affde2d349e3b3bfbd3d0f6afb5d76282a7 (patch)
tree5432c8fcca66a63397e0f16a907bf6db33384365 /src/librustc_data_structures
parenteca1cc957fff157575f485ebfd2aaafb33ee98cb (diff)
downloadrust-00e48affde2d349e3b3bfbd3d0f6afb5d76282a7.tar.gz
rust-00e48affde2d349e3b3bfbd3d0f6afb5d76282a7.zip
Replace FnvHasher use with FxHasher.
This speeds up compilation by 3--6% across most of rustc-benchmarks.
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/lib.rs1
-rw-r--r--src/librustc_data_structures/obligation_forest/mod.rs10
-rw-r--r--src/librustc_data_structures/snapshot_map/mod.rs6
3 files changed, 9 insertions, 8 deletions
diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs
index fc963dac949..fdcbec6bac1 100644
--- a/src/librustc_data_structures/lib.rs
+++ b/src/librustc_data_structures/lib.rs
@@ -60,6 +60,7 @@ pub mod snapshot_vec;
 pub mod transitive_relation;
 pub mod unify;
 pub mod fnv;
+pub mod fx;
 pub mod tuple_slice;
 pub mod veccell;
 pub mod control_flow_graph;
diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs
index a2bfa784e8a..a46238309bb 100644
--- a/src/librustc_data_structures/obligation_forest/mod.rs
+++ b/src/librustc_data_structures/obligation_forest/mod.rs
@@ -15,7 +15,7 @@
 //! in the first place). See README.md for a general overview of how
 //! to use this class.
 
-use fnv::{FnvHashMap, FnvHashSet};
+use fx::{FxHashMap, FxHashSet};
 
 use std::cell::Cell;
 use std::collections::hash_map::Entry;
@@ -68,9 +68,9 @@ pub struct ObligationForest<O: ForestObligation> {
     /// backtrace iterator (which uses `split_at`).
     nodes: Vec<Node<O>>,
     /// A cache of predicates that have been successfully completed.
-    done_cache: FnvHashSet<O::Predicate>,
+    done_cache: FxHashSet<O::Predicate>,
     /// An cache of the nodes in `nodes`, indexed by predicate.
-    waiting_cache: FnvHashMap<O::Predicate, NodeIndex>,
+    waiting_cache: FxHashMap<O::Predicate, NodeIndex>,
     /// A list of the obligations added in snapshots, to allow
     /// for their removal.
     cache_list: Vec<O::Predicate>,
@@ -158,8 +158,8 @@ impl<O: ForestObligation> ObligationForest<O> {
         ObligationForest {
             nodes: vec![],
             snapshots: vec![],
-            done_cache: FnvHashSet(),
-            waiting_cache: FnvHashMap(),
+            done_cache: FxHashSet(),
+            waiting_cache: FxHashMap(),
             cache_list: vec![],
             scratch: Some(vec![]),
         }
diff --git a/src/librustc_data_structures/snapshot_map/mod.rs b/src/librustc_data_structures/snapshot_map/mod.rs
index a4e6166032d..cd7143ad3ce 100644
--- a/src/librustc_data_structures/snapshot_map/mod.rs
+++ b/src/librustc_data_structures/snapshot_map/mod.rs
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use fnv::FnvHashMap;
+use fx::FxHashMap;
 use std::hash::Hash;
 use std::ops;
 use std::mem;
@@ -19,7 +19,7 @@ mod test;
 pub struct SnapshotMap<K, V>
     where K: Hash + Clone + Eq
 {
-    map: FnvHashMap<K, V>,
+    map: FxHashMap<K, V>,
     undo_log: Vec<UndoLog<K, V>>,
 }
 
@@ -40,7 +40,7 @@ impl<K, V> SnapshotMap<K, V>
 {
     pub fn new() -> Self {
         SnapshotMap {
-            map: FnvHashMap(),
+            map: FxHashMap(),
             undo_log: vec![],
         }
     }