git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC 0/5] New hash table implementation

From
Karsten Blees <karsten.blees@gmail.com>
Date
Sep 10, 2013, 23:27 UTC
Message-ID
<522FAAC4.2080601@gmail.com>
Also here: https://github.com/kblees/git/tree/kb/hashmap
Hi,
this is a spin-off of my (very slowly progressing) msysgit fscache project. I needed to remove things from the hash table, which cannot be implemented efficiently in hash.[ch].
So I wrote hasmap.[ch], with these features:
- O(1) remove
- builtin entry chaining
- ready-to-use FNV-1 hash functions
- unit test
- additions are ~twice as fast
- uses less memory

Patches 2 and 5 convert existing uses of hash.[ch] to hashmap.[ch]. Patches 3 and 4 are useful optimizations of their own.

I haven't found the time to tackle name-hash.c yet, this is where remove() could come into play (to replace the CE_UNHASHED flag).
Karsten
Karsten Blees (5):
  add a hashtable implementation that supports O(1) removal
  buitin/describe.c: use new hash map implementation
  diffcore-rename.c: move code around to prepare for the next patch
  diffcore-rename.c: simplify finding exact renames
  diffcore-rename.c: use new hash map implementation
 Makefile           |   3 +
 builtin/describe.c |  53 +++++------
 diffcore-rename.c  | 185 +++++++++++++-------------------------
 hashmap.c          | 210 +++++++++++++++++++++++++++++++++++++++++++
 hashmap.h          | 200 +++++++++++++++++++++++++++++++++++++++++
 t/t0011-hashmap.sh | 236 ++++++++++++++++++++++++++++++++++++++++++++++++
 test-hashmap.c     | 258 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 995 insertions(+), 150 deletions(-)
 create mode 100644 hashmap.c
 create mode 100644 hashmap.h
 create mode 100755 t/t0011-hashmap.sh
 create mode 100644 test-hashmap.c
-- 
1.8.4.8243.gbcbdefd
Next: Karsten Blees
Message 1 of 24 in “New hash table implementation”
  1. 0/5 New hash table implementationKarsten Blees, Sep 10, 2013
  2. 1/5 add a hashtable implementation that supports O(1) removalKarsten Blees, Sep 10, 2013
  3. Junio C HamanoSep 11, 2013
  4. Karsten BleesSep 23, 2013
  5. Junio C HamanoSep 12, 2013
  6. Karsten BleesSep 23, 2013
  7. 2/5 buitin/describe.c: use new hash map implementationKarsten Blees, Sep 10, 2013
  8. 3/5 diffcore-rename.c: move code around to prepare for the next patchKarsten Blees, Sep 10, 2013
  9. 4/5 diffcore-rename.c: simplify finding exact renamesKarsten Blees, Sep 10, 2013
  10. 5/5 diffcore-rename.c: use new hash map implementationKarsten Blees, Sep 10, 2013
  11. 0/5 New hash table implementationKarsten Blees, Sep 24, 2013
  12. 1/5 add a hashtable implementation that supports O(1) removalKarsten Blees, Sep 24, 2013
  13. 2/5 buitin/describe.c: use new hash map implementationKarsten Blees, Sep 24, 2013
  14. 3/5 diffcore-rename.c: move code around to prepare for the next patchKarsten Blees, Sep 24, 2013
  15. 4/5 diffcore-rename.c: simplify finding exact renamesKarsten Blees, Sep 24, 2013
  16. 5/5 diffcore-rename.c: use new hash map implementationKarsten Blees, Sep 24, 2013
  17. Fredrik GustafssonSep 24, 2013
  18. Tay Ray ChuanSep 24, 2013
  19. Karsten BleesSep 26, 2013
  20. Fredrik GustafssonSep 26, 2013
  21. Duy NguyenSep 26, 2013
  22. Fredrik GustafssonSep 26, 2013
  23. Duy NguyenSep 26, 2013
  24. Karsten BleesSep 26, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.