On Thu, Sep 15, 2016 at 09:26:22AM -0700, Stefan Beller wrote: > > It may also be possible to really micro-optimize it on some platforms, > > because we know the size in advance (I'd kind of expect the compiler to > > do that, but if we're ending up in glibc memcmp then it sounds like it > > is not the case). > > That stackoverflow link suggests that glibc already has microoptimisations > for a variety of platforms. It's definitely micro-optimized in glibc. What I was trying to say is that if we are hitting the glibc implementation, then we know we are handling the "20" at runtime. Whereas the compiler should know that "20" is a constant, and could in theory skip the memcmp() call entirely in favor of something like an unrolled loop. -Peff