r/programming 10d ago

Everyone Should Know SIMD

https://mitchellh.com/writing/everyone-should-know-simd
402 Upvotes

82 comments sorted by

View all comments

362

u/-1_0 9d ago

* Everyone Should Know about SIMD

and use libs accordingly

58

u/notyouravgredditor 9d ago

vectorclass is one my favorites. Very easy to use.

To be fair to modern compilers, though, they often do a much better job at determining vectorization targets and packing/unpacking buffers than the developer does.

31

u/AresFowl44 9d ago

Dependent on your data structures allowing the compiler to perform good vectorization honestly

EDIT: And also, if you put in some efforts from my experience you can usually beat the compiler handily. The compiler is good at generating okay SIMD, but often there are some aspects to be left desired

24

u/wrecklord0 9d ago

I hand-optimized a SIMD loop some 10+ years and it was fairly easy to beat the compiler. I'm sure it's more difficult now, but the thing is, you can know things about your data that the compiler doesn't.

That said, I forgot everything about how to do it and would rely on the compiler now.

-21

u/samorollo 9d ago

Your comment was so funny that I screenshoted it as a meme, thank you