Skip to content

Optimize Float floor and ceil - #5

Closed
austinorr wants to merge 1 commit into
masterfrom
opt-float-floor-ceil
Closed

Optimize Float floor and ceil#5
austinorr wants to merge 1 commit into
masterfrom
opt-float-floor-ceil

Conversation

@austinorr

@austinorr austinorr commented Mar 17, 2026

Copy link
Copy Markdown
Owner

Hi, this is the first of a few PRs that I've teed up that have shown some performance improvements. I've tried to keep these simple and standalone so that they're easy to review independently of one another rather than stacking them all up into one PR (though i'd be happy to close these and submit as one PR if you prefer).

This one includes very minor changes to the float floor and ceil implementations for f32 and f64 with SSE2 that uses the rounding intrinsic instead of the transmute+scalar+transmute approach.

These yield nice performance gains though:

  • f32 floor SSE2 -88% (8x faster)
  • f32 ceil SSE2 -87%
  • f64 floor SSE2 -82%
  • f64 ceil SSE2 -79%

These were benchmarked with the benches saved here: #4

use this command if you've saved a v2 baseline already.
cargo bench --bench bench_main -- "float_rounding" --baseline baseline

@austinorr austinorr closed this Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant