Skip to content

Commit dfa124c

Browse files
connortsui20claude
andcommitted
bench: compare dense and compressed union children
Moves the union take benchmark to the `vortex` crate, which already depends on both `vortex-array` and `vortex-sparse`, and adds a compressed shape alongside the dense one. Rows are skewed 98% integers to 1% strings and 1% lists, which is the distribution the sparse layout exists for. The `dense_children` cases materialize every child at the union's length. The `compressed_children` cases keep the dominant integer child canonical and store each rare child as a `SparseArray`, which is what a compressor produces. Compressed children turn out to be 3.3x slower to take, not faster. The cost is cache-missing binary searches in `Patches::take`: with 1000 patches against 128 indices the ratio stays above `PREFER_MAP_WHEN_PATCHES_OVER_INDICES_LESS_THAN`, so every call searches. That is a `Patches` cost rather than a union one, and union take multiplies it by the variant count. The compressed cases run over the sub-millisecond budget the other microbenchmarks hold to. The gap only appears once a child's patch indices outgrow the cache, so a size inside the budget measures nothing. Signed-off-by: Connor Tsui <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014VBqADUGaR81PoijKkvoUs
1 parent 8bbec19 commit dfa124c

4 files changed

Lines changed: 251 additions & 154 deletions

File tree

‎vortex-array/Cargo.toml‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,6 @@ harness = false
243243
name = "take_struct"
244244
harness = false
245245

246-
[[bench]]
247-
name = "take_union"
248-
harness = false
249-
250246
[[bench]]
251247
name = "take_fsl"
252248
harness = false

‎vortex-array/benches/take_union.rs‎

Lines changed: 0 additions & 150 deletions
This file was deleted.

‎vortex/Cargo.toml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ name = "common_encoding_tree_throughput"
105105
harness = false
106106
test = false
107107

108+
[[bench]]
109+
name = "take_union"
110+
harness = false
111+
test = false
112+
108113
[[bench]]
109114
name = "pipeline"
110115
harness = false

0 commit comments

Comments
 (0)