Skip to content

Commit 7317ac8

Browse files
committed
Prescient only on hit path
1 parent 17bcdd2 commit 7317ac8

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

src/cache.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,7 @@ where
122122
if i != u32::MAX {
123123
return cache.0.read().values[i as usize].clone();
124124
}
125-
126-
// Execute the function with the new constraints hooked in.
127-
let sink = |call: In::Call, hash: u128| {
128-
if call.is_mutable() {
129-
list.lock().mutable.push(call);
130-
true
131-
} else {
132-
list.lock().immutable.insert(call, hash)
133-
}
134-
};
135-
let value = func(input.retrack(sink, bump));
136-
cache.0.write().values.push(value.clone());
137-
return value;
138-
}
139-
140-
// Check if there is a cached output.
141-
if let Some((i, value, mutable)) = cache.0.read().lookup::<In>(key, &input) {
125+
} else if let Some((i, value, mutable)) = cache.0.read().lookup::<In>(key, &input) {
142126
PRESCIENCE_WRITE.hit(i);
143127

144128
#[cfg(feature = "testing")]

0 commit comments

Comments
 (0)