Lokathor / wide

A crate to help you go wide. By which I mean use SIMD stuff.
https://docs.rs/wide
zlib License
284 stars 24 forks source link

Reduce add #51

Closed ronniec95 closed 4 years ago

ronniec95 commented 4 years ago

Horizontal Add functionality which is 2x-4x faster than iter.sum() in my benches

ronniec95 commented 4 years ago

Hey Lokathor

Feel free to merge this and my other PR. Both should now be working a bit more robustly. I fixed the sign_bits() bug for pow() so now it behaves correctly for NAN cases.

For this PR:- Horizontal/reduce add seems to be faster than casting to an array and summing. It's particularly seems faster when doing an iter.sum() on an array of floats/doubles often by 4x. Maybe that's something to take back to rustc team as I don't think we should be able to write better code by hand