Optimize lock_shards

This commit is contained in:
John Kåre Alsaker
2023-08-17 11:07:50 +02:00
parent b74cb78d63
commit f458b112f8
4 changed files with 42 additions and 34 deletions

View File

@@ -70,8 +70,7 @@ where
}
fn iter(&self, f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex)) {
let shards = self.cache.lock_shards();
for shard in shards.iter() {
for shard in self.cache.lock_shards() {
for (k, v) in shard.iter() {
f(k, &v.0, v.1);
}
@@ -160,8 +159,7 @@ where
}
fn iter(&self, f: &mut dyn FnMut(&Self::Key, &Self::Value, DepNodeIndex)) {
let shards = self.cache.lock_shards();
for shard in shards.iter() {
for shard in self.cache.lock_shards() {
for (k, v) in shard.iter_enumerated() {
if let Some(v) = v {
f(&k, &v.0, v.1);