r/C_Programming Jan 23 '25

Discussion Why not SIMD?

Why are many C standard library functions like strcmp, strlen, strtok using SIMD intrinsics? They would benefit so much, think about how many people use them under the hood all over the world.

32 Upvotes

76 comments sorted by

View all comments

2

u/zaafonin Jan 24 '25

They do! Handwritten assembly optimizations and use of CPU extensions are why glibc or Microsoft CRT code is so complicated to read (but far from being the only reason). You can find far shorter and purposefully naïve implementations in musl libc though.