Repository navigation
Optimize list_contains with prepared constant sets - #10052
robert3005 wants to merge 1 commit into
Conversation
8e24c7e to
f1eea0e
Compare
Merging this PR will regress 10 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | optimize_lookup_predicate[ids=192, shape=in_list] |
50.4 µs | 75.5 µs | -33.2% |
| ❌ | Simulation | optimize_lookup_predicate[ids=128, shape=in_list] |
51.1 µs | 72.9 µs | -29.97% |
| ❌ | Simulation | optimize_lookup_predicate[ids=64, shape=in_list] |
50.9 µs | 70.3 µs | -27.6% |
| ❌ | WallTime | mul_u64_nonnull_neon |
28.7 µs | 39.2 µs | -26.64% |
| ❌ | Simulation | optimize_lookup_predicate[ids=16, shape=in_list] |
51.7 µs | 69.1 µs | -25.1% |
| ❌ | Simulation | optimize_lookup_predicate[ids=256, shape=in_list] |
79.4 µs | 104.7 µs | -24.2% |
| ❌ | Simulation | optimize_lookup_predicate[ids=1, shape=in_list] |
74.8 µs | 89.6 µs | -16.46% |
| ❌ | WallTime | multiply_shapes_neon[(32768, PerRowPerRow)] |
32.7 µs | 38.1 µs | -14.15% |
| ❌ | WallTime | mul_i64_nonnull_neon |
32.7 µs | 38.1 µs | -14.08% |
| ❌ | Simulation | or_true_constant |
18.5 µs | 20.6 µs | -10.2% |
| ⚡ | Simulation | i64_random_chunked[256] |
15,817.7 µs | 171.1 µs | ×92 |
| ⚡ | Simulation | utf8_random[256] |
13,524.8 µs | 355.5 µs | ×38 |
| ⚡ | Simulation | i64_random[256] |
4,360.6 µs | 131.1 µs | ×33 |
| ⚡ | Simulation | nested_list_random[32] |
6.7 ms | 1 ms | ×6.7 |
| ⚡ | WallTime | bitpack_blocked_compress_avx512 |
5.6 µs | 4.7 µs | +18.98% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/friendly-knuth-dj6ed1-list-contains (79947bc) with develop (731a231)
Footnotes
-
359 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. ↩
f1eea0e to
ef75b12
Compare
ef75b12 to
f350f7b
Compare
|
How do i extend this to work for new custom kernels? I really think we want to make probe an array to allow reduce/execute rules? |
3e6c3cb to
12f4b8f
Compare
12f4b8f to
4b5ce4a
Compare
4b5ce4a to
74eda6a
Compare
ab3ce3b to
fd2586b
Compare
cfed2d7 to
b888b1b
Compare
5bea57b to
6207abb
Compare
159aaff to
77f114d
Compare
| parent: ArrayView<'_, ScalarFn>, | ||
| child_idx: usize, | ||
| ) -> VortexResult<Option<ArrayRef>> { | ||
| if parent.scalar_fn().is::<ListContains>() { |
There was a problem hiding this comment.
this is a hack, we essentially have common setup we would like to share across chunks, if we just dispatch over each chunk there's no place to store the shared state
`list_contains(lit([...]), needles)`, the `IN` shape, built one `Eq` per set element and OR-reduced them: a pass over the needles per element. The constant list is now prepared once into a probe structure and every needle is probed in a single pass. The probe adapts to the elements: integers, and floats by their bit patterns, use a bitmap over a dense span or a sorted slice; decimals their unscaled values the same way; UTF-8 and binary a table keyed by the view for short values and by the bytes for long ones; nested rows a sorted index over the row comparator. A literal list becomes a `PreparedSetLiteral` when the expression is optimized, so every batch probes one shared set; a constant list in an array tree becomes a `PreparedSetArray` on optimization. Reduce rules for `Dict`, `RunEnd`, `Chunked` and `Sequence` push the function into their values or chunks with slices of that array, so all share the set. The list-column-against-needle-column case, previously unsupported, gathers each list's elements next to its row's needle for one equality. A list scalar's elements are written straight from their values rather than through a scalar per element. The `list_contains_set` benchmark covers integer, string and nested sets over flat and chunked needles. Signed-off-by: Robert Kruszewski <robert@spiraldb.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TAbnsC5szeE4SiAmR3FciD
4677d2e to
79947bc
Compare
Replace constant-set membership comparison/OR chains with prepared, single-pass probes