1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-16 06:03:44 +01:00
git/Documentation/technical
Karsten Blees 6a364ced49 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>
2013-11-18 13:03:51 -08:00
..
.gitignore
api-allocation-growing.txt
api-argv-array.txt
api-builtin.txt
api-config.txt
api-credentials.txt
api-decorate.txt
api-diff.txt
api-directory-listing.txt
api-gitattributes.txt
api-grep.txt
api-hash.txt
api-hashmap.txt add a hashtable implementation that supports O(1) removal 2013-11-18 13:03:51 -08:00
api-history-graph.txt
api-in-core-index.txt
api-index-skel.txt
api-index.sh
api-lockfile.txt
api-merge.txt
api-object-access.txt
api-parse-options.txt
api-quote.txt
api-ref-iteration.txt
api-remote.txt
api-revision-walking.txt
api-run-command.txt
api-setup.txt
api-sha1-array.txt
api-sigchain.txt
api-strbuf.txt
api-string-list.txt
api-tree-walking.txt
api-xdiff-interface.txt
http-protocol.txt Documentation: make AsciiDoc links always point to HTML files 2013-09-06 14:49:06 -07:00
index-format.txt
pack-format.txt
pack-heuristics.txt Merge branch 'mn/doc-pack-heu-remove-dead-pastebin' 2013-09-12 14:41:47 -07:00
pack-protocol.txt
protocol-capabilities.txt
protocol-common.txt
racy-git.txt
send-pack-pipeline.txt
shallow.txt
trivial-merge.txt