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

Re: [PATCH 5/6] Do linear-time/space rename logic for exact renames

From
Jeff King <peff@peff.net>
Date
Oct 25, 2007, 19:48 UTC
Message-ID
<20071025194859.GB27745@coredump.intra.peff.net>
In-Reply-To
<Pine.LNX.4.64.0710251522190.7345@iabervon.org>
On Thu, Oct 25, 2007 at 03:43:46PM -0400, Daniel Barkalow wrote:
Show 6 quoted lines
> Creating a list of the pointers doesn't work correctly with the grow 
> implementation, because growing the hash may turn a collision into a 
> non-collision, at which point items other than the first cannot be found 
> (since they're listed inside a bucket that's now wrong for them). AFAIK, 
> resizing a hash table requires being able to figure out what happened with 
> collisions.

I thought this at first, too, but there are two types of collisions in this hash implementation: those that come from having the actual 32-bit hash collide, and those that come from not having enough buckets.

The client code gets a pointer kicked back to it when there is a collision on the actual hash value (i.e., two things had the exact same hash value). The number of buckets grows when you simply have more buckets filled than you like. Two different hashes that would be in the same bucket don't actually occupy the same bucket -- the second one to arrive gets shoved into the next available bucket.

-Peff
Previous: Daniel BarkalowNext: Daniel Barkalow
Message 12 of 18 in “Cleaned-up rename detection patch-series”
  1. 0/6 Cleaned-up rename detection patch-seriesLinus Torvalds, Oct 25, 2007
  2. 1/6 Add 'diffcore.h' to LIB_HLinus Torvalds, Oct 25, 2007
  3. 2/6 Split out "exact content match" phase of rename detectionLinus Torvalds, Oct 25, 2007
  4. 3/6 Ref-count the filespecs used by diffcoreLinus Torvalds, Oct 25, 2007
  5. 4/6 copy vs rename detection: avoid unnecessary O(n*m) loopsLinus Torvalds, Oct 25, 2007
  6. Junio C HamanoOct 26, 2007
  7. Linus TorvaldsOct 26, 2007
  8. Junio C HamanoOct 26, 2007
  9. Linus TorvaldsOct 26, 2007
  10. 5/6 Do linear-time/space rename logic for exact renamesLinus Torvalds, Oct 25, 2007
  11. Daniel BarkalowOct 25, 2007
  12. Jeff KingOct 25, 2007
  13. Daniel BarkalowOct 25, 2007
  14. Linus TorvaldsOct 25, 2007
  15. Daniel BarkalowOct 25, 2007
  16. 6/6 Do exact rename detection regardless of rename limitsLinus Torvalds, Oct 25, 2007
  17. Linus TorvaldsOct 25, 2007
  18. Jeff KingOct 25, 2007

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.