Re: [PATCH 2/2] hashcmp: use memcmp instead of open-coded loop

2017-08-09 Thread Jeff King
On Wed, Aug 09, 2017 at 04:55:43PM +0200, René Scharfe wrote: > > I also wondered if using memcmp() could be a hint to the compiler to use > > an intrinsic or some other trick, especially because the "len" here is a > > constant. But in a toy function compiled with "gcc -S", it looks like we > > d

Re: [PATCH 2/2] hashcmp: use memcmp instead of open-coded loop

2017-08-09 Thread René Scharfe
Am 09.08.2017 um 12:16 schrieb Jeff King: > In 1a812f3a70 (hashcmp(): inline memcmp() by hand to > optimize, 2011-04-28), it was reported that an open-coded > loop outperformed memcmp() for comparing sha1s. > > Discussion[1] a few years later in 2013 showed that this > depends on your libc's versi

[PATCH 2/2] hashcmp: use memcmp instead of open-coded loop

2017-08-09 Thread Jeff King
In 1a812f3a70 (hashcmp(): inline memcmp() by hand to optimize, 2011-04-28), it was reported that an open-coded loop outperformed memcmp() for comparing sha1s. Discussion[1] a few years later in 2013 showed that this depends on your libc's version of memcmp(). In particular, glibc 2.13 optimized th