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

Re: If I were redoing git from scratch...

From
Linus Torvalds <torvalds@osdl.org>
Date
Nov 4, 2006, 23:15 UTC
Message-ID
<Pine.LNX.4.64.0611041509370.25218@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.64.0611041436050.25218@g5.osdl.org>
On Sat, 4 Nov 2006, Linus Torvalds wrote:
Show 5 quoted lines
> 
> In addition to that, we need one pointer per hash entry, and in order to 
> keep the hash list size down we need that hash array to be about 25% free, 
> so say 1.5 pointers per object: ~6 bytes or ~12 bytes depending on whether 
> it's a 32- or 64-bit architecture.

Btw, one of the things I considered (but rejected as being _too_ far out for now) during the memory shrinking thing was to make both 32-bit and 64-bit entities use a 32-bit hash table entry.

The way to do that would be to instead of using a pointer, use a 32-bit integer where the low ~10 bits are an index into the allocation buffer (since we batch allocations), and the rest of the bits would be an index into which batch-buffer it is.

Exactly because 8 bytes per hash entry is actually right now a big part of the object memory allocation overhead on 64-bit architectures, and cutting it down to just 4 bytes would help save memory.

I never got around to it, if only because I actually just compile my user-land git stuff as 32-bit, even on my ppc64 system. And partly because I had shrunk the object allocations enough that I just felt pretty happy with it anyway, and the change would have been pretty painful. But on 64-bit architectures, the hash table right now is about a third of the whole memory overhead of the object database, and cutting it down by half would actually be noticeable.

Previous: Linus Torvalds
Message 7 of 7 in “If I were redoing git from scratch...”
  1. Junio C HamanoNov 4, 2006
  2. Jakub NarebskiNov 4, 2006
  3. Linus TorvaldsNov 4, 2006
  4. Shawn PearceNov 4, 2006
  5. Robin RosenbergNov 4, 2006
  6. Linus TorvaldsNov 4, 2006
  7. Linus TorvaldsNov 4, 2006

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.