Skip to content

Reduce number of clones and drops in expression optimisation logic - #9378

Merged
robert3005 merged 4 commits into
developfrom
rk/exproptimise
Aug 12, 2026
Merged

Reduce number of clones and drops in expression optimisation logic#9378
robert3005 merged 4 commits into
developfrom
rk/exproptimise

Conversation

@robert3005

@robert3005 robert3005 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Expression optimisation performs a lot of unnecessary clones and drops. Instead of having an extensible trait we limit the optimisation logic to only happen over Expressions and Arrays, logically these are the only two types we might want to run optimisations over. Using that simplification we convert majority of the allocations into borrows

@robert3005 robert3005 added the changelog/performance A performance improvement label Aug 12, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 12, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 1.1%

⚡ 4 improved benchmarks
❌ 6 regressed benchmarks
✅ 1952 untouched benchmarks
🆕 12 new benchmarks
⏩ 89 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation compact_sliced[(16384, 10)] 1.5 ms 2 ms -27.28%
Simulation compact_sliced[(4096, 10)] 391.5 µs 528.5 µs -25.92%
Simulation take[small_m/shuffled/primitive/nonnull/chunks=1024/indices=1000] 5.3 ms 6.1 ms -13.22%
Simulation take[small_m/shuffled/primitive/nonnull/chunks=16384/indices=256] 3 ms 3.5 ms -13.05%
Simulation take[small_m/shuffled/primitive/nonnull/chunks=1024/indices=256] 2 ms 2.3 ms -12.53%
Simulation take[small_m/shuffled/primitive/nonnull/chunks=16384/indices=1000] 9 ms 10.2 ms -12.19%
Simulation optimize_or_chain[200] 1,177 µs 558.4 µs ×2.1
Simulation chunked_dict_primitive_into_canonical[f32, (1000, 100, 100)] 1.8 ms 1.6 ms +10.95%
Simulation chunked_dict_primitive_into_canonical[f32, (1000, 10, 100)] 1.7 ms 1.5 ms +10.87%
Simulation take[small_m/shuffled/primitive/nonnull/chunks=16384/indices=16] 1.2 ms 1.1 ms +10.63%
🆕 Simulation optimize_lookup_predicate[ids=1, shape=balanced_or] N/A 49.6 µs N/A
🆕 Simulation optimize_lookup_predicate[ids=1, shape=in_list] N/A 148.5 µs N/A
🆕 Simulation optimize_lookup_predicate[ids=1024, shape=balanced_or] N/A 2.3 ms N/A
🆕 Simulation optimize_lookup_predicate[ids=1024, shape=in_list] N/A 50.5 µs N/A
🆕 Simulation optimize_lookup_predicate[ids=16, shape=balanced_or] N/A 93.4 µs N/A
🆕 Simulation optimize_lookup_predicate[ids=16, shape=in_list] N/A 48.5 µs N/A
🆕 Simulation optimize_lookup_predicate[ids=256, shape=balanced_or] N/A 616.6 µs N/A
🆕 Simulation optimize_lookup_predicate[ids=256, shape=in_list] N/A 50.4 µs N/A
🆕 Simulation optimize_lookup_predicate[ids=4096, shape=balanced_or] N/A 8.9 ms N/A
🆕 Simulation optimize_lookup_predicate[ids=4096, shape=in_list] N/A 57 µs N/A
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rk/exproptimise (fabbce3) with develop (a0a0b20)

Open in CodSpeed

Footnotes

  1. 89 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.

Comment thread vortex-array/src/expr/optimize.rs Outdated
Comment thread vortex-array/Cargo.toml Outdated
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005

Copy link
Copy Markdown
Contributor Author

we might need to change it again for layouts but this is at least the direction

@robert3005
robert3005 enabled auto-merge (squash) August 12, 2026 11:19
Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005
robert3005 merged commit 5e07c24 into develop Aug 12, 2026
74 of 75 checks passed
@robert3005
robert3005 deleted the rk/exproptimise branch August 12, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants