lookup_object: remove hashtable_index() and optimize hash_obj()
commit9f36c9b7f77f188db47b80ae1118856249beaa15
authorNicolas Pitre <nico@fluxnic.net>
Tue, 10 Sep 2013 22:17:12 +0000 (10 18:17 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Sep 2013 19:25:33 +0000 (11 12:25 -0700)
treefc85141e788ce1e2c989d155f205e29451916624
parente230c568c4b9a991e3175e5f65171a566fd8e39c
lookup_object: remove hashtable_index() and optimize hash_obj()

hashtable_index() appears to be a close duplicate of hash_obj().
Keep only the later and make it usable for all cases.

Also remove the modulus as this is an expensive operation.
The size argument is always a power of 2 anyway, so a simple
mask operation provides the same result.

On a 'git rev-list --all --objects' run this decreased the time spent
in lookup_object from 27.5% to 24.1%.

[jc: with a few comments on "modulus turned into mask" by Peff]

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object.c