summaryrefslogtreecommitdiff
path: root/Documentation/technical/api-sigchain.txt
diff options
context:
space:
mode:
authorLibravatar Karsten Blees <karsten.blees@gmail.com>2013-11-14 20:17:54 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-11-18 13:03:51 -0800
commit6a364ced497e407ab3ffb2554d4ef2c78f801832 (patch)
treed3f6ee1a0ae10dc4e6cbca185fbc99ca7ac70930 /Documentation/technical/api-sigchain.txt
parentsubmodule: don't access the .gitmodules cache entry after removing it (diff)
downloadtgif-6a364ced497e407ab3ffb2554d4ef2c78f801832.tar.xz
add a hashtable implementation that supports O(1) removal
The existing hashtable implementation (in hash.[ch]) uses open addressing (i.e. resolve hash collisions by distributing entries across the table). Thus, removal is difficult to implement with less than O(n) complexity. Resolving collisions of entries with identical hashes (e.g. via chaining) is left to the client code. Add a hashtable implementation that supports O(1) removal and is slightly easier to use due to builtin entry chaining. Supports all basic operations init, free, get, add, remove and iteration. Also includes ready-to-use hash functions based on the public domain FNV-1 algorithm (http://www.isthe.com/chongo/tech/comp/fnv). The per-entry data structure (hashmap_entry) is piggybacked in front of the client's data structure to save memory. See test-hashmap.c for usage examples. The hashtable is resized by a factor of four when 80% full. With these settings, average memory consumption is about 2/3 of hash.[ch], and insertion is about twice as fast due to less frequent resizing. Lookups are also slightly faster, because entries are strictly confined to their bucket (i.e. no data of other buckets needs to be traversed). Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/technical/api-sigchain.txt')
0 files changed, 0 insertions, 0 deletions