Skip to content

break: pass len into spare_capacity_mut - #9839

Closed
joseph-isaacs wants to merge 1 commit into
developfrom
ji/buffer-spare-capacity-len
Closed

joseph-isaacs wants to merge 1 commit into
developfrom
ji/buffer-spare-capacity-len

Conversation

@joseph-isaacs

@joseph-isaacs joseph-isaacs commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

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

…eck since the capacity can be larger than the requested cap

Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
@joseph-isaacs
joseph-isaacs requested a review from myrrc September 11, 2026 10:38
AdamGS
AdamGS previously requested changes Sep 11, 2026

@AdamGS AdamGS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spare_capacity_mut is a common API in the std, I think staying familiar is a much better API.

@joseph-isaacs

joseph-isaacs commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

What do you propose avoid this common footgun all over the codebase

@codspeed

codspeed Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 5.68%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 4 regressed benchmarks
✅ 166 untouched benchmarks
⏩ 2244 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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. ↩

@joseph-isaacs joseph-isaacs reopened this Sep 11, 2026
@AdamGS
AdamGS dismissed their stale review September 11, 2026 13:12

Dismissing my own review.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been marked as stale because it has been open for 14 days with no activity. Please comment or remove the stale label if you wish to keep it active, otherwise it will be closed in 7 days

@github-actions github-actions Bot added the stale This PR is stale and will be auto-closed soon label Sep 26, 2026
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

This PR was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions Bot closed this Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale This PR is stale and will be auto-closed soon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants