Repository navigation
Commit dfa124c
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_014VBqADUGaR81PoijKkvoUs1 parent 8bbec19 commit dfa124c
4 files changed
Lines changed: 251 additions & 154 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | 246 | | |
251 | 247 | | |
252 | 248 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
0 commit comments