Dug up this historic example from glibc of why optimizing compilers are a necessary mitigation against hideous code: https://sourceware.org/git/?p=glibc.git;a=blob;f=string/strstr.c;hb=0ecb606cb6cf65de1d9fc8a919bceb4be476c602 …
-
-
Replying to @RichFelker
should also link to musl strstr so we can really see the comparison. also what is the perf difference at -O1 btw musl and glibc for this?
2 replies 0 retweets 0 likes -
Replying to @johnregehr
musl's is a linear-time algorithm and is roughly the same # of LoC. Timing is highly dependent on inputs. https://git.musl-libc.org/cgit/musl/tree/src/string/strstr.c …
2 replies 0 retweets 1 like
Replying to @RichFelker @johnregehr
(Of course musl's code density is considerably higher, but it even has more/better comments than the old naive glibc one, I think... ;-)
8:45 AM - 24 Apr 2017
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.