mirror of
https://github.com/gorules/zen.git
synced 2026-11-30 16:11:58 +00:00
perf(trace): share row-wise node outputs with the trace when nothing can alias them
This commit is contained in:
@@ -498,7 +498,9 @@ impl Plan {
|
||||
shared: plain && CompiledGraph::flat_scalars(columns),
|
||||
},
|
||||
};
|
||||
Box::new(super::PlanTrace::new(graph.steps.len(), source, lazy))
|
||||
let mut trace = super::PlanTrace::new(graph.steps.len(), source, lazy);
|
||||
trace.aliased = overlapping;
|
||||
Box::new(trace)
|
||||
}),
|
||||
};
|
||||
run.walk(root.clone()).await;
|
||||
|
||||
@@ -59,6 +59,7 @@ pub(crate) struct PlanTrace<'a> {
|
||||
values: Vec<Option<Rc<Data<'a>>>>,
|
||||
pub(crate) source: Source<'a>,
|
||||
lazy: bool,
|
||||
pub(crate) aliased: bool,
|
||||
pub(crate) refused: Option<&'static str>,
|
||||
}
|
||||
|
||||
@@ -73,6 +74,7 @@ impl<'a> PlanTrace<'a> {
|
||||
values: vec![None; slots],
|
||||
source,
|
||||
lazy,
|
||||
aliased: true,
|
||||
refused: None,
|
||||
}
|
||||
}
|
||||
@@ -196,11 +198,14 @@ impl<'a> Run<'_, 'a> {
|
||||
if let Some(trace) = self.trace.as_mut() {
|
||||
trace.hosted.push(Hosted {
|
||||
node,
|
||||
values: output
|
||||
.materialized()
|
||||
.iter()
|
||||
.map(Variable::deep_clone)
|
||||
.collect(),
|
||||
values: match trace.aliased {
|
||||
true => output
|
||||
.materialized()
|
||||
.iter()
|
||||
.map(Variable::deep_clone)
|
||||
.collect(),
|
||||
false => output.materialized(),
|
||||
},
|
||||
kernel,
|
||||
walked,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user