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

Hash Tables

From
Philip Herron <herron.philip@googlemail.com>
Date
Aug 6, 2009, 04:35 UTC
Message-ID
<4A7A5D9C.7000604@googlemail.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey guys

This is my first time posting to git mailing-list didn't get much response from irc.

I've been loving git and just been poking at its hash tables in hash.{c,h}, which are very nice. I've been implementing my own hash tables and i have some questions on how you guys done it.

1 - Are you using the sha1.c as your hashing function? And why did you choose it, I have been playing with a few different ones to see how it goes.

2 -table lookup i see your hash_table has an unsigned int nr, not
quite sure what that is for num_remaing      or something is what i
first thought.
    But i see in your table lookup you use hash % size and it returns
an index to the array. And would love       to  know how that works.
Is size the current number of hash entries in the table?

3 - what is the initial table size as in when you first insert an entry into the table, the array must be allocated to a length, and you grow when you reach a threshold.

Anyways thanks!
- --Phil
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkp6XZsACgkQAhcOgIaQQ2HWGgCfU6l909k7/JK3gf6BB2Cu35xB jBIAn2Jl6UWp5ZvTXJxUWc91tgn//z25 =6l91 -----END PGP SIGNATURE-----

Next: Philip Herron
Message 1 of 3 in “Hash Tables”
  1. Philip HerronAug 6, 2009
  2. Philip HerronAug 6, 2009
  3. Thomas RastAug 6, 2009

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.