Use inputs_outputs len as approximation

This commit is contained in:
Micha Reiser 2024-12-04 09:45:23 +01:00
parent 8f6dcaf632
commit 5314d4ccc9
No known key found for this signature in database

View file

@ -1,3 +1,5 @@
use super::{Configuration, IngredientImpl};
use crate::zalsa_local::QueryOrigin;
use crate::{
accumulator::{self, accumulated_map::AccumulatedMap},
hash::FxHashSet,
@ -5,8 +7,6 @@ use crate::{
AsDynDatabase, DatabaseKeyIndex, Id,
};
use super::{Configuration, IngredientImpl};
impl<C> IngredientImpl<C>
where
C: Configuration,
@ -76,15 +76,9 @@ where
continue;
};
let estimated_inputs = match &origin {
QueryOrigin::Assigned(_) | QueryOrigin::BaseInput => 0,
QueryOrigin::Derived(edges) | QueryOrigin::DerivedUntracked(edges) => {
edges.input_outputs.len()
}
};
stack.reserve(estimated_inputs);
visited.reserve(estimated_inputs);
if let QueryOrigin::Derived(edges) | QueryOrigin::DerivedUntracked(edges) = &origin {
stack.reserve(edges.input_outputs.len());
}
stack.extend(
origin