[Python-Dev] talking about performance... [case closed]

Daniel Berlin dan@cgsoftware.com
Tue, 20 Jun 2000 09:55:11 -0700 (PDT)


> So the intent of the code is to avoid the expense of calling memcmp if a
> full n-character memcmp can't possibly find equality at i (due to mismatch
> of first characters), and the assumption is that first characters mismatch
> frequently.  Both seem like good calls to me!

However, smart compilers (gcc 2.95+ fer instance) will produce an inline
memcmp call that is faster, and has no overhead (IE it's not making a
library call).
Thus, the first character mismatch test is useless.
We had the same thing in strcmp macros in GDB, where we tested the first
character, then strcmp'd.
It was faster to just strcmp, even when they *did* mismatch.

--Dan