Re: [PATCH] fast-import: use hashcmp() for SHA1 hash comparison

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 18.07.2014 20:42, schrieb Jonathan Nieder:
René Scharfe wrote:

Signed-off-by: Rene Scharfe <l.s.r@xxxxxx>
---
  fast-import.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Before:

   $ size git-fast-import
      text    data     bss     dec     hex filename
    804138    6768  754160 1565066  17e18a git-fast-import

After:

   $ size git-fast-import
      text    data     bss     dec     hex filename
    804154    6768  754160 1565082  17e19a git-fast-import

So this makes the text size worse on this machine (amd64, building
with gcc 4.8.2 -O2).  That's probably because the old code does 'call
memcmp', while the new code inlines it.  Inlining is presumably the
better choice.

More importantly, the new code is more readable.

Yes, the latter point is the important one.

If inlining is really better is another matter; I don't understand how 1a812f3a (hashcmp(): inline memcmp() by hand to optimize) could have made git gc 18% faster, as it claimed. I would expect memcmp(), which can compare more than a byte at a time, to be significantly faster -- or at least just as fast as whatever the compiler does with the inlined version.

René
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]