diff options
author | Michael Schubert <schu@schu.io> | 2012-07-27 12:53:09 +0400 |
---|---|---|
committer | Michael Schubert <schu@schu.io> | 2012-07-29 22:50:58 +0400 |
commit | f6b26e770ffae621408532c5b2c1aae4fa1c9e49 (patch) | |
tree | 6d8aceb0bb50223d2f4791e11d6cab171923e0ec /src/oidmap.h | |
parent | 6810ba089a543a2407b1c8824dffa9b4e1d63975 (diff) |
git_oid_cmp: inline memcmp by hand to optimize
git.git uses an inlined hashcmp function instead of memcmp, since it
performes much better when comparing hashes (most hashes compared
diverge within the first byte).
Measurements and rationale for the curious reader:
http://thread.gmane.org/gmane.comp.version-control.git/172286
Diffstat (limited to 'src/oidmap.h')
-rw-r--r-- | src/oidmap.h | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/oidmap.h b/src/oidmap.h index 5a0bab6ec..1791adb16 100644 --- a/src/oidmap.h +++ b/src/oidmap.h @@ -28,13 +28,8 @@ GIT_INLINE(khint_t) hash_git_oid(const git_oid *oid) return h; } -GIT_INLINE(int) hash_git_oid_equal(const git_oid *a, const git_oid *b) -{ - return (memcmp(a->id, b->id, sizeof(a->id)) == 0); -} - #define GIT__USE_OIDMAP \ - __KHASH_IMPL(oid, static kh_inline, const git_oid *, void *, 1, hash_git_oid, hash_git_oid_equal) + __KHASH_IMPL(oid, static kh_inline, const git_oid *, void *, 1, hash_git_oid, git_oid_equal) #define git_oidmap_alloc() kh_init(oid) #define git_oidmap_free(h) kh_destroy(oid,h), h = NULL |