this post was submitted on 08 Apr 2024
0 points (NaN% liked)
Rust
5974 readers
14 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
So the problem discovered is that the compiler can't optimize the loops by unrolling them (due to floating point issues?). The proposed solution is to unroll the loop manually.
But wouldn't it be much cleaner and more performant to just have a macro like
#![allow lossy floating point optimizations]
and let the compiler figure out the rest?Compilers exist to compile and optimize things. Manually unrolling loops might improve performance on one machine, but completely break the program on another. It's much safer and more performant in the long term to allow the compiler the leeway to optimize things the optimal way.