Skip to content

Add bound expression rewrite optimizer - #9627

Draft
mhk197 wants to merge 1 commit into
developfrom
mk/bound-expression-optimizer
Draft

Add bound expression rewrite optimizer#9627
mhk197 wants to merge 1 commit into
developfrom
mk/bound-expression-optimizer

Conversation

@mhk197

@mhk197 mhk197 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a deterministic bottom-up optimizer for bound expressions
  • preserve expression dtypes across rewrites and reject invalid or unchanged replacements
  • organize built-in rewrites by binary, cast, structural, null, and conditional families

Changes

  • add a reusable BoundExpressionOptimizer with ordered rule registration and a rewrite-cycle budget
  • use a per-invocation OptimizationRun with small inline task and result stacks
  • rebuild parent nodes only when an optimized child changed
  • mirror the existing scalar-function simplify and reduce behaviors with bound-expression rules
  • document the optimizer state machine and every built-in rewrite with original and rewritten examples

Testing

  • cargo test -p vortex-array expr::optimizer
  • cargo test --doc -p vortex-array
  • cargo clippy --all-targets --all-features
  • cargo +nightly fmt --all -- --check
  • git diff --check

Signed-off-by: Matt Katz <mhkatz97@gmail.com>
@codspeed-hq

codspeed-hq Bot commented Aug 25, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 30.63%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
✅ 445 untouched benchmarks
⏩ 1770 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime arrow_checked_add_u32_neon[16384] 20.4 µs 12.4 µs +65.02%
WallTime arrow_checked_add_u32_avx512[16384] 21.3 µs 17.6 µs +20.67%
WallTime mul_u32_nonnull_avx512 6.3 µs 5.6 µs +11.94%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mk/bound-expression-optimizer (83e8bba) with develop (ee1ac25)

Open in CodSpeed

Footnotes

  1. 1770 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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