Repository navigation
Commit 402fd1d
authored
fix(buffer): reject ZSTs and address allocator review comments (#9807)
Reject zero-sized buffer elements at construction with compile-time
assertions. ZST support was previously inconsistent; rejecting these
types prevents division-by-zero and pointer-distance failures without
adding iterator or growth special cases. Empty buffers of non-ZST types
remain supported. Six compile-fail doctests cover the independent
construction paths.
Remove the generic raw-owner constructor. Typed Vec adoption takes its
pointer and element count directly from the Vec and retains that Vec for
destruction. External byte owners continue to use `Bytes::from_owner` at
the call site, without adding a buffer API.
Address the allocator-stack review comments with field documentation, an
explanation of the optional allocator, and tests for owner lifetime,
allocator retention, empty/shared ownership, sliced-buffer growth, and
alignment. The allocator representation, buffer layout, alignment
policy, and allocation benchmarks are retained. Both iterator-extension
implementations and the owned iterator match the merged baseline. This
is a focused alternative to #9745.
Validation:
- `cargo nextest run -p vortex-buffer --all-features`: 874 tests passed.
- `cargo test --doc -p vortex-buffer --all-features`: 8 ordinary and 6
compile-fail doctests passed.
- `cargo clippy -p vortex-buffer --all-targets --all-features`: passed.
- Nightly formatting and `git diff --check`: passed.
- Workspace clippy was blocked locally by the CUDA nvCOMP download; full
CI is running on this revision.
Performance validation:
- Three serial alternating local comparisons against the allocator-stack
baseline place all 20 measured interleave, batched i8 filter, and
multiplication cases within 2% of baseline.
- The final Graviton NEON run matches develop: u64 multiplication 15.1
vs 15.3 µs; i64 and 16,384-row multiplication 17.1 vs approximately 17.3
µs. The earlier NEON slowdowns disappeared with the ZST ban.
- The complete final CodSpeed report passed with no reported
regressions.
---------
Signed-off-by: Nicholas Gates <[email protected]>1 parent 803a3dc commit 402fd1d
3 files changed
Lines changed: 165 additions & 65 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
| |||
333 | 341 | | |
334 | 342 | | |
335 | 343 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | 344 | | |
356 | 345 | | |
357 | 346 | | |
358 | 347 | | |
359 | 348 | | |
360 | 349 | | |
361 | | - | |
| 350 | + | |
362 | 351 | | |
363 | 352 | | |
364 | 353 | | |
| |||
386 | 375 | | |
387 | 376 | | |
388 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
389 | 381 | | |
390 | 382 | | |
391 | 383 | | |
| 384 | + | |
392 | 385 | | |
393 | 386 | | |
394 | 387 | | |
| |||
462 | 455 | | |
463 | 456 | | |
464 | 457 | | |
465 | | - | |
466 | | - | |
| 458 | + | |
| 459 | + | |
467 | 460 | | |
468 | 461 | | |
469 | | - | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
470 | 465 | | |
471 | 466 | | |
472 | 467 | | |
473 | 468 | | |
| 469 | + | |
474 | 470 | | |
475 | 471 | | |
476 | 472 | | |
| |||
498 | 494 | | |
499 | 495 | | |
500 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
501 | 537 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
31 | 54 | | |
32 | 55 | | |
| 56 | + | |
33 | 57 | | |
| 58 | + | |
34 | 59 | | |
| 60 | + | |
35 | 61 | | |
| 62 | + | |
36 | 63 | | |
37 | 64 | | |
38 | 65 | | |
| |||
100 | 127 | | |
101 | 128 | | |
102 | 129 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 130 | | |
120 | 131 | | |
121 | 132 | | |
| |||
228 | 239 | | |
229 | 240 | | |
230 | 241 | | |
| 242 | + | |
231 | 243 | | |
232 | 244 | | |
233 | 245 | | |
| |||
277 | 289 | | |
278 | 290 | | |
279 | 291 | | |
| 292 | + | |
280 | 293 | | |
281 | 294 | | |
282 | 295 | | |
| |||
309 | 322 | | |
310 | 323 | | |
311 | 324 | | |
| 325 | + | |
312 | 326 | | |
313 | 327 | | |
314 | 328 | | |
| |||
802 | 816 | | |
803 | 817 | | |
804 | 818 | | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | 819 | | |
820 | 820 | | |
821 | 821 | | |
822 | 822 | | |
823 | 823 | | |
| 824 | + | |
824 | 825 | | |
825 | 826 | | |
826 | 827 | | |
827 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
828 | 838 | | |
829 | 839 | | |
830 | 840 | | |
| |||
1094 | 1104 | | |
1095 | 1105 | | |
1096 | 1106 | | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1097 | 1143 | | |
1098 | 1144 | | |
1099 | 1145 | | |
| |||
1151 | 1197 | | |
1152 | 1198 | | |
1153 | 1199 | | |
| 1200 | + | |
1154 | 1201 | | |
1155 | 1202 | | |
1156 | 1203 | | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
1157 | 1209 | | |
1158 | 1210 | | |
1159 | 1211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
26 | 38 | | |
| 39 | + | |
27 | 40 | | |
| 41 | + | |
28 | 42 | | |
| 43 | + | |
29 | 44 | | |
| 45 | + | |
30 | 46 | | |
| 47 | + | |
31 | 48 | | |
| 49 | + | |
32 | 50 | | |
33 | 51 | | |
34 | 52 | | |
| |||
100 | 118 | | |
101 | 119 | | |
102 | 120 | | |
| 121 | + | |
103 | 122 | | |
104 | 123 | | |
105 | 124 | | |
| |||
131 | 150 | | |
132 | 151 | | |
133 | 152 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 153 | + | |
139 | 154 | | |
140 | 155 | | |
141 | 156 | | |
| |||
204 | 219 | | |
205 | 220 | | |
206 | 221 | | |
| 222 | + | |
207 | 223 | | |
208 | 224 | | |
209 | 225 | | |
| |||
226 | 242 | | |
227 | 243 | | |
228 | 244 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 245 | + | |
234 | 246 | | |
235 | 247 | | |
236 | 248 | | |
| |||
0 commit comments