Skip to content

Commit

Permalink
remove hashbrown
Browse files Browse the repository at this point in the history
  • Loading branch information
cheme committed Dec 5, 2023
1 parent 5dd6a4b commit 14d09fb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions substrate/primitives/trie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ harness = false
[dependencies]
ahash = { version = "0.8.2", optional = true }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false }
hashbrown = { version = "0.13.2", optional = true }
hash-db = { version = "0.16.0", default-features = false }
lazy_static = { version = "1.4.0", optional = true }
memory-db = { version = "0.32.0", default-features = false }
Expand Down Expand Up @@ -50,7 +49,6 @@ std = [
"ahash",
"codec/std",
"hash-db/std",
"hashbrown",
"lazy_static",
"memory-db/std",
"nohash-hasher",
Expand Down
8 changes: 4 additions & 4 deletions substrate/primitives/trie/src/cache/shared_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
///! that combines both caches and is exported to the outside.
use super::{CacheSize, NodeCached};
use hash_db::Hasher;
use hashbrown::{hash_set::Entry as SetEntry, HashSet};
use nohash_hasher::BuildNoHashHasher;
use parking_lot::{Mutex, RwLock, RwLockWriteGuard};
use schnellru::LruMap;
use std::{
collections::{hash_map::Entry as SetEntry, HashMap},
hash::{BuildHasher, Hasher as _},
sync::Arc,
};
Expand Down Expand Up @@ -148,7 +148,7 @@ pub struct SharedValueCacheLimiter {
heap_size: usize,

/// A set with all of the keys deduplicated to save on memory.
known_storage_keys: HashSet<Arc<[u8]>>,
known_storage_keys: HashMap<Arc<[u8]>, ()>,

/// A counter with the number of elements that got evicted from the cache.
///
Expand Down Expand Up @@ -189,10 +189,10 @@ where
}

self.heap_size += new_item_heap_size;
entry.insert();
entry.insert(());
},
SetEntry::Occupied(entry) => {
key.storage_key = entry.get().clone();
key.storage_key = entry.key().clone();
},
}

Expand Down

0 comments on commit 14d09fb

Please sign in to comment.