Cache materialized spans per context and size emitter extents from the subject query

This commit is contained in:
Dennis Kobert
2026-08-23 00:57:37 +00:00
parent 6fe533a875
commit 3fb8b10f80
4 changed files with 157 additions and 93 deletions

View File

@@ -44,19 +44,28 @@ impl<'a> ExtentIn<'a> {
/// A ranked (`IList`) input materialized whole: `get` drives the batch and
/// yields the level as a [`List`](crate::node::List), for extents that depend
/// on the input's data rather than its counts alone.
/// on the input's data rather than its counts alone. `total` answers the
/// subject's flat count without materializing, so count-shaped extents stay
/// cheap: a materializing extent inside another's subject multiplies, and
/// nested emitters turn that into a blowup.
pub struct ListIn<'a, T> {
get: &'a dyn Fn() -> GPoll<crate::node::List<'a, T>>,
total: &'a dyn Fn() -> GPoll<crate::gpoll::Extent>,
}
impl<'a, T> ListIn<'a, T> {
pub fn new(get: &'a dyn Fn() -> GPoll<crate::node::List<'a, T>>) -> Self {
Self { get }
pub fn new(get: &'a dyn Fn() -> GPoll<crate::node::List<'a, T>>, total: &'a dyn Fn() -> GPoll<crate::gpoll::Extent>) -> Self {
Self { get, total }
}
pub fn get(&self) -> GPoll<crate::node::List<'a, T>> {
(self.get)()
}
/// The subject wire's total flat extent as a plain query.
pub fn total(&self) -> GPoll<crate::gpoll::Extent> {
(self.total)()
}
}
/// The queried absolute level (innermost `0`), paired with the node's depth.