Speed up git notes lookup
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Sat, 12 Sep 2009 16:08:37 +0000 (18:08 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 12 Sep 2009 18:32:08 +0000 (11:32 -0700)
commitc97a34867d0eb00713ce205a89dae97bc749154a
treecb4124f28977f1dad838d7cfd39a0dbab5a4544f
parent886dc7c063799a2003d86cdb127ed68f627907c8
Speed up git notes lookup

To avoid looking up each and every commit in the notes ref's tree
object, which is very expensive, speed things up by slurping the tree
object's contents into a hash_map.

The idea for the hashmap singleton is from David Reiss, initial
benchmarking by Jeff King.

Note: the implementation allows for arbitrary entries in the notes
tree object, ignoring those that do not reference a valid object.  This
allows you to annotate arbitrary branches, or objects.

This patch has been improved by the following contributions:
- Junio C Hamano: fixed an obvious error in initialize_hash_map()

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes.c