Skip to content

Reduce GetItem over struct scan plans - #9068

Draft
joseph-isaacs wants to merge 10 commits into
developfrom
agent/reduce-get-item-struct-scan-plan
Draft

Reduce GetItem over struct scan plans#9068
joseph-isaacs wants to merge 10 commits into
developfrom
agent/reduce-get-item-struct-scan-plan

Conversation

@joseph-isaacs

@joseph-isaacs joseph-isaacs commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a non-nullable StructScanPlan that presents its fields to abstract reduction as a Pack
  • apply the existing GetItem(Pack(...)) reduction so a rooted field access becomes a physical field scan plan
  • construct only the selected StructFieldScanPlan lazily; sibling plan trees are never allocated
  • retain the LayoutReaderScanPlanV2 compatibility source for expressions that do not reduce and for old execution
  • add a cold planning benchmark against the existing struct layout-reader path

This PR is stacked directly on #9005 (ji/planning-old-execute).

Laziness and performance

The benchmark uses a real StructLayout and instruments LayoutChildren::child. Every timed iteration creates a fresh StructReader, so its LazyReaderChildren cache cannot carry over from an earlier iteration. Both benchmark paths assert on every iteration that:

  1. fresh reader/plan construction materializes zero children;
  2. planning the first GetItem materializes exactly one child.

Quick local Criterion results for cold construction plus selecting the last field:

Struct width Layout reader Struct scan plan
10 3.88 µs 4.51 µs
100 11.73 µs 12.73 µs
1,000 93.71 µs 91.93 µs

The shared width scaling comes from the existing eager struct-reader metadata/root-expression setup. The scan plan adds no sibling child-plan or child-reader materialization.

Checks

  • cargo +nightly fmt --all
  • cargo test -p vortex-layout get_item_reduces_to_a_struct_field_scan_plan
  • VORTEX_SCAN_IMPL=planv2 RUSTC_WRAPPER= cargo test -p vortex-layout --all-features --lib (197 passed)
  • cargo bench -p vortex-layout --bench scan_plan -- --quick
  • cargo clippy -p vortex-layout --all-targets --all-features -- -D warnings
  • cargo clippy --all-targets --all-features -- -D warnings
  • git diff --check

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
…ecute

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
f
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
…ecute

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
f
Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
Signed-off-by: "Joe Isaacs" <joe.isaacs@live.co.uk>
Signed-off-by: "Joe Isaacs" <joe.isaacs@live.co.uk>
Base automatically changed from ji/planning-old-execute to develop July 29, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant