Repository navigation
Commit b53d487
committed
perf(sparse): build the fixed-size-list fill tile once, not once per gap
`append_fill` handed the fill scalar to `Constant::append_to_builder` per gap,
which materialized the scalar's elements into an array every time. Hoist that
out of the loop the way the list path already does: the fill's elements become
an array once, up front, and every gap tiles that same array through
`FixedSizeListBuilder::append_array_as_repeated_list`.
A fixed-size list holds its elements back to back, so it cannot point a run of
rows at one shared range the way a list view can - but it need not copy the
tile per row either. The run goes in as a `ChunkedArray` of `n` clones of the
tile, which costs `n` reference bumps and no element data at all. The child
keeps that whole run as a single chunk: unpacking it would spill a chunk per
row into the child's chunk list, which every later append and the final
`finish` walk, and that list is what makes the difference - unpacking measured
36.0 us against 26.0 us on `(512, 7, 4)`.
Elements that are all the same scalar do better still, collapsing to a single
constant chunk however many rows they cover.
`canonicalize_sparse_fixed_size_list` medians, against develop:
(512, 7, 4) 21.1 us -> 26.0 us (was 79.0 us)
(1024, 17, 8) 29.1 us -> 22.7 us (was 139.5 us)
(8192, 1024, 4) 150.1 us -> 34.5 us (was 375.9 us)
Signed-off-by: Robert Kruszewski <robert@spiraldb.com>1 parent 6c44824 commit b53d487
3 files changed
Lines changed: 129 additions & 75 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
371 | 377 | | |
372 | 378 | | |
373 | 379 | | |
| |||
384 | 390 | | |
385 | 391 | | |
386 | 392 | | |
387 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
388 | 399 | | |
389 | 400 | | |
390 | 401 | | |
| |||
404 | 415 | | |
405 | 416 | | |
406 | 417 | | |
407 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
408 | 424 | | |
409 | 425 | | |
410 | 426 | | |
411 | 427 | | |
412 | | - | |
| 428 | + | |
| 429 | + | |
413 | 430 | | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
421 | 454 | | |
422 | 455 | | |
423 | 456 | | |
424 | 457 | | |
425 | 458 | | |
426 | 459 | | |
427 | 460 | | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
433 | 467 | | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | 468 | | |
440 | 469 | | |
441 | 470 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
| |||
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
| 94 | + | |
88 | 95 | | |
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | 100 | | |
117 | 101 | | |
118 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
110 | | - | |
| 111 | + | |
111 | 112 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
115 | 119 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
120 | 169 | | |
121 | | - | |
122 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
123 | 174 | | |
124 | 175 | | |
125 | 176 | | |
| |||
139 | 190 | | |
140 | 191 | | |
141 | 192 | | |
| 193 | + | |
142 | 194 | | |
143 | | - | |
| 195 | + | |
144 | 196 | | |
145 | 197 | | |
146 | | - | |
| 198 | + | |
147 | 199 | | |
148 | 200 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
161 | 209 | | |
162 | | - | |
163 | 210 | | |
164 | 211 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 212 | + | |
172 | 213 | | |
173 | 214 | | |
174 | 215 | | |
| |||
0 commit comments