Latest Results
Introduce ParentRef and ArrayParts::optimize chain
`ArrayRef::slice/filter/take` previously allocated a wrapper array
(`SliceArray`, `FilterArray`, `DictArray`) and called `.optimize()` on
the resulting `ArrayRef`, relying on a `reduce_parent` rule to throw the
wrapper away. The wrapper allocation was always paid even when reduction
ran in one shot.
This change establishes the API surface for moving the wrapper onto the
stack:
- `ParentRef<'a>`: a parent representation that optionally borrows an
`&ArrayRef` and otherwise carries the encoding-specific data, dtype,
length, slots, and encoding id directly. `into_array_ref(self)` clones
the underlying `Arc` when the parent is heap-backed.
- `ParentView<'a, V>`: a typed view of a parent that derefs to
`V::ArrayData` without holding an `&ArrayRef`. Used by the upcoming
matcher path that accepts stack-allocated parents.
- `DynArray::data_any` exposes the encoding-specific data so a matcher
can downcast to `V::ArrayData` from a `ParentRef` regardless of
whether the parent is heap- or stack-backed.
- `ArrayParts<V>::optimize`, `optimize_ctx(session)`, and `into_array`,
plus `Optimized<V>` with its own `into_array`. Callers chain
`parts.optimize()?.into_array()` so reduction is an explicit,
orthogonal step from materialization.
- `ArrayRef::slice / filter / take` now build an `ArrayParts<V>` and
drive it through the chain.
The internals of `ArrayParts::optimize` still materialize before
running the existing `reduce_parent` chain, so this PR does not yet
remove the `Arc<ArrayInner<V>>` allocation. Wiring `ParentRef` through
`DynArray::reduce_parent`, `VTable::reduce_parent`, `ParentRuleSet`,
`DynArrayParentReduceRule`, `ReduceParentFn`, the `Matcher` API, and
the per-encoding rule bodies is the follow-up that delivers the
allocation savings.
- `cargo build --workspace`
- `cargo nextest run -p vortex-array -p vortex-fastlanes -p vortex-fsst -p vortex-alp -p vortex-runend -p vortex-zigzag` (all 3078 pass; the 21 skipped are timezone-dependent and unrelated to this change)
- `cargo clippy -p vortex-array --all-targets --all-features`
- `cargo +nightly fmt --all -- --check`
- `./scripts/public-api.sh`refactor/parent-ref-stack-allocated Latest Branches
0%
-21%
refactor/parent-ref-stack-allocated +13%
ngates/faster-from-slices © 2026 CodSpeed Technology