memmem small optimalisation

Joerg Sonnenberger joerg at britannica.bec.de
Fri Feb 24 08:12:15 UTC 2012


On Thu, Feb 23, 2012 at 05:34:03PM -0800, Xin Li wrote:
> Did you benchmarked the change?  Changes like this has to be done very
> carefully since it's possible that the extra time spent on addition
> and subtractions, when multiple by the length of the "long" string,
> may actually defeat the benefit of one less byte worth memory compare
> because the effect of CPU's data cache.

More importantly, if the input was originally aligned, the additional
byte is ~free.

Joerg


More information about the freebsd-hackers mailing list