• steventrouble@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    5 months ago

    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.