break: pass len into spare_capacity_mut - #9839
Conversation
…eck since the capacity can be larger than the requested cap Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
AdamGS
left a comment
There was a problem hiding this comment.
spare_capacity_mut is a common API in the std, I think staying familiar is a much better API.
|
What do you propose avoid this common footgun all over the codebase |
Merging this PR will degrade performance by 5.68%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | filtered_owned_i64_avx512[OneNullInEight] |
22.3 µs | 26.3 µs | -15.09% |
| ❌ | dict_canonicalize_gt_u8_neon[1000000] |
487.3 µs | 559.3 µs | -12.87% |
| ❌ | mul_i32_nonnull_avx512 |
7.1 µs | 7.9 µs | -10.8% |
| ❌ | dict_canonicalize_gt_u8_neon[16000000] |
8.4 ms | 9.3 ms | -10.12% |
| ⚡ | dict_canonicalize_gt_u8_avx2[16000000] |
11.1 ms | 8.8 ms | +25.89% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing ji/buffer-spare-capacity-len (8aa5cef) with develop (f9093df)
Footnotes
-
2244 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
This is a common perf bottleneck since the capacity can be larger than the requested cap.
If the slice has a known length a compile can avoid bounds checks when writing to it