]> git.lizzy.rs Git - rust.git/blobdiff - library/proc_macro/src/bridge/handle.rs
proc_macro: use fxhash within the proc_macro crate
[rust.git] / library / proc_macro / src / bridge / handle.rs
index 7d6adda48ec6e4f21102937b9c49b810654fb316..00954107b7769c8af31d6d2c3e5f3a938716926c 100644 (file)
@@ -1,11 +1,13 @@
 //! Server-side handles and storage for per-handle data.
 
-use std::collections::{BTreeMap, HashMap};
+use std::collections::BTreeMap;
 use std::hash::Hash;
 use std::num::NonZeroU32;
 use std::ops::{Index, IndexMut};
 use std::sync::atomic::{AtomicUsize, Ordering};
 
+use super::fxhash::FxHashMap;
+
 pub(super) type Handle = NonZeroU32;
 
 /// A store that associates values of type `T` with numeric handles. A value can
@@ -54,12 +56,12 @@ fn index_mut(&mut self, h: Handle) -> &mut T {
 /// Like `OwnedStore`, but avoids storing any value more than once.
 pub(super) struct InternedStore<T: 'static> {
     owned: OwnedStore<T>,
-    interner: HashMap<T, Handle>,
+    interner: FxHashMap<T, Handle>,
 }
 
 impl<T: Copy + Eq + Hash> InternedStore<T> {
     pub(super) fn new(counter: &'static AtomicUsize) -> Self {
-        InternedStore { owned: OwnedStore::new(counter), interner: HashMap::new() }
+        InternedStore { owned: OwnedStore::new(counter), interner: FxHashMap::default() }
     }
 
     pub(super) fn alloc(&mut self, x: T) -> Handle {