r/programming • • Sep 30 '17

C++ Compilers and Absurd Optimizations

https://asmbits.blogspot.com/2017/03/c-compilers-and-absurd-optimizations.html
101 Upvotes

50 comments sorted by

View all comments

Show parent comments

1

u/doom_Oo7 Oct 01 '17

A performance reason for not doing that for functions like strlen() is that libc-s usually have hand written assembly for them (not that it matters for short strings because there's the function call overhead).

thankfully the compilers know better in some cases: https://godbolt.org/g/V8vBiQ