Commit 5af6a6e
committed
perf: optimize slow path and fix benchmark in ByteViewGroupValueBuilder
Three follow-up changes addressing PR review and CI feedback on #21794:
1. Remove `required-features = ["test_utils"]` from the `aggregate_vectorized`
bench target. The gate caused the bench to be silently skipped when CI ran
`cargo bench --features=parquet --bench aggregate_vectorized`. The bench
compiles fine in a workspace build where `arrow/test_utils` is already
enabled via feature unification through `datafusion-physical-expr`.
2. Replace `arrow::util::test_util::seedable_rng()` with
`StdRng::seed_from_u64(42)` from the already-present `rand` crate.
This was the only import from `test_util` (as opposed to `bench_util`)
and removes the last explicit dependency on the `test_utils` feature
in the benchmark.
3. Optimize the slow path in `vectorized_append_inner` (non-inline strings,
`!data_buffers().is_empty()`), addressing Dandandan's review comment.
Instead of calling `do_append_val_inner` which goes through
`array.value(row)` (buffer lookup + slice construction) and then
`make_view` (re-reads the first 4 bytes to build the prefix), the new
path reads `arr.views()[row]` directly and copies `src.prefix` from the
source `ByteView`. Benchmarks show 41–53% improvement for 64-byte strings
and 6–16% improvement for random-length strings (null_density=0.0).1 parent 9621004 commit 5af6a6e
3 files changed
Lines changed: 37 additions & 10 deletions
File tree
- datafusion/physical-plan
- benches
- src/aggregates/group_values/multi_group_by
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| 32 | + | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
131 | | - | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
144 | | - | |
| 145 | + | |
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | | - | |
| 158 | + | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| |||
236 | 237 | | |
237 | 238 | | |
238 | 239 | | |
239 | | - | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
252 | | - | |
| 253 | + | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| |||
262 | 263 | | |
263 | 264 | | |
264 | 265 | | |
265 | | - | |
| 266 | + | |
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
| |||
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
177 | 178 | | |
178 | 179 | | |
179 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
180 | 207 | | |
181 | 208 | | |
182 | 209 | | |
| |||
0 commit comments