Skip to content

Commit 072ada7

Browse files
committed
Revert "just walk active query stack once"
This reverts commit 2d79486.
1 parent 484d6dd commit 072ada7

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

src/cycle.rs

-14
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,6 @@ impl CycleHeads {
119119
.any(|head| head.database_key_index == *value)
120120
}
121121

122-
pub(crate) fn contains_at_iteration(
123-
&self,
124-
database_key_index: DatabaseKeyIndex,
125-
iteration_count: u32,
126-
) -> bool {
127-
self.into_iter().any(|head| {
128-
head.database_key_index == database_key_index && head.iteration_count == iteration_count
129-
})
130-
}
131-
132122
pub(crate) fn remove(&mut self, value: &DatabaseKeyIndex) -> bool {
133123
let Some(cycle_heads) = &mut self.0 else {
134124
return false;
@@ -144,10 +134,6 @@ impl CycleHeads {
144134
true
145135
}
146136

147-
pub(crate) fn len(&self) -> usize {
148-
self.0.as_ref().map(|heads| heads.len()).unwrap_or_default()
149-
}
150-
151137
pub(crate) fn update_iteration_count(
152138
&mut self,
153139
cycle_head_index: DatabaseKeyIndex,

src/function/maybe_changed_after.rs

+11-14
Original file line numberDiff line numberDiff line change
@@ -276,21 +276,18 @@ where
276276
"{database_key_index:?}: validate_same_iteration(memo = {memo:#?})",
277277
memo = memo.tracing_debug()
278278
);
279-
280-
let heads = &memo.revisions.cycle_heads;
281-
let num_heads = heads.len();
282-
db.zalsa_local().with_query_stack(|stack| {
283-
let mut found = 0;
284-
for entry in stack.iter() {
285-
if heads.contains_at_iteration(entry.database_key_index, entry.iteration_count) {
286-
found += 1;
287-
if found == num_heads {
288-
return true;
289-
}
290-
}
279+
for cycle_head in &memo.revisions.cycle_heads {
280+
if !db.zalsa_local().with_query_stack(|stack| {
281+
stack.iter().any(|entry| {
282+
entry.database_key_index == cycle_head.database_key_index
283+
&& entry.iteration_count == cycle_head.iteration_count
284+
})
285+
}) {
286+
return false;
291287
}
292-
false
293-
})
288+
}
289+
290+
true
294291
}
295292

296293
/// VerifyResult::Unchanged if the memo's value and `changed_at` time is up-to-date in the

0 commit comments

Comments
 (0)