Skip to content

move Buffer/BufferMut panic helpers into separate functions - #9927

Merged
myrrc merged 2 commits into
developfrom
myrrc/buffer-cold-helpers
Sep 18, 2026
Merged

myrrc merged 2 commits into
developfrom
myrrc/buffer-cold-helpers

Conversation

@myrrc

@myrrc myrrc commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Continuation of #9903. Buffer/BufferMut are used everywhere, so inlining their panic handlers both increases code size and degrades performance.

Signed-off-by: Mikhail Kot <mikhail@spiraldb.com>
@myrrc myrrc added the changelog/performance A performance improvement label Sep 17, 2026
@codspeed

codspeed Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 4 benchmarks

⚠️ 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

⚡ 12 improved benchmarks
❌ 4 regressed benchmarks
✅ 2189 untouched benchmarks
⏩ 218 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ WallTime dict_canonicalize_gt_u8_avx512[16000000] 6.8 ms 11.3 ms -39.92%
❌ WallTime arrow_checked_add_u32_neon[16384] 12.9 µs 20.3 µs -36.68%
❌ Simulation decompress[u64, (4000, 1024)] 72.1 µs 86.7 µs -16.86%
❌ WallTime dict_canonicalize_gt_u8_avx512[1000000] 419.7 µs 471.5 µs -11%
⚡ Simulation slice_empty_tight_loop_vortex 37.5 µs 9.2 µs ×4.1
⚡ WallTime mul_u64_nonnull_neon 20.5 µs 15.6 µs +31.79%
⚡ Simulation slice_tight_loop_vortex[65536] 56.1 µs 45.8 µs +22.62%
⚡ Simulation allocate_drop_bytes[0] 635.5 ns 527.2 ns +20.55%
⚡ WallTime filtered_sink_i64_avx2[OneNullInEight] 26.4 µs 21.9 µs +20.36%
⚡ WallTime multiply_shapes_neon[(16384, PerRowPerRow)] 20.1 µs 17.4 µs +15.38%
⚡ WallTime mul_i64_nonnull_neon 20.1 µs 17.4 µs +15.3%
⚡ WallTime words_gather_scalar_avx2[65536] 9.4 µs 8.2 µs +13.74%
⚡ WallTime filtered_sink_i64_neon[NineNullsInTen] 19.6 µs 17.4 µs +12.93%
⚡ WallTime mul_u32_nonnull_avx512 6.3 µs 5.6 µs +11.51%
⚡ Simulation slice_vortex_buffer 3.4 µs 3.1 µs +11.3%
⚡ Simulation decompress[u64, (4000, 4)] 140.2 µs 126.7 µs +10.6%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing myrrc/buffer-cold-helpers (6edcb0f) with develop (48985d5)

Open in CodSpeed

Footnotes

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

@myrrc
myrrc marked this pull request as ready for review September 17, 2026 11:47
@myrrc
myrrc requested a review from robert3005 September 17, 2026 11:47
@myrrc
myrrc marked this pull request as draft September 17, 2026 11:48
@myrrc
myrrc removed the request for review from robert3005 September 17, 2026 11:49
@AdamGS

AdamGS commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

nice
Screenshot 2026-09-17 at 12 50 35

@myrrc

myrrc commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

arrow_checked_add_u32_neon doesn't have Buffer/BufferMut, unrelated

@myrrc

myrrc commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

dict_canonicalize_gt_u8_avx512[16000000] is very instable in CI, also unrelated

@myrrc
myrrc marked this pull request as ready for review September 17, 2026 12:09
@myrrc
myrrc requested a review from AdamGS September 17, 2026 12:10
@myrrc
myrrc enabled auto-merge (squash) September 17, 2026 12:11
@AdamGS

AdamGS commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

One downside here is that the backtrace location will be inside the util function instead of the original callsite.

@myrrc

myrrc commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Yeah, this is +1 frame, but I think it's fine since our messages point to the right place anyway

@myrrc
myrrc requested a review from robert3005 September 17, 2026 13:32
@robert3005

Copy link
Copy Markdown
Contributor

I think you can fix the frame problem that Adam mentioned by adding #[track_caller] to these functions. That's what things like Option::unwrap do

@myrrc

myrrc commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

@robert3005 We have a chain of helper -> vortex_panic! -> __private::panic. The correct way of propagating this to caller would be to track_caller on every of them, but this adds to function's costs and inlining works worse. I still think the messages are informative enough for us (or user) to determine where the error happened.

@myrrc

myrrc commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Also, on vortex_expect! this won't work because then vortex_expect should be a track_caller, but it's not

@robert3005 robert3005 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.

ok, we can clean the call sites in the future

@myrrc
myrrc merged commit c6678f3 into develop Sep 18, 2026
84 of 85 checks passed
@myrrc
myrrc deleted the myrrc/buffer-cold-helpers branch September 18, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants