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

Re: What's cooking in git.git (topics)

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Oct 3, 2007, 17:53 UTC
Message-ID
<alpine.LFD.0.999.0710031007340.3579@woody.linux-foundation.org>
In-Reply-To
<20071003165927.GA25055@coredump.intra.peff.net>
On Wed, 3 Oct 2007, Jeff King wrote:
Show 5 quoted lines
>
> Try profiling the code, and you will see that the creation of the hashes
> is totally dwarfed by the comparisons. So yes, you might be able to
> speed up the creation code, but it's going to have a minimal impact on
> the overall run time.
Yeah. Oprofile is your friend.

The biggest win would be to avoid calling diffcore_count_changes() in the first place, and we actually do that in the caller by looking at the size of the files. However, while that prunes out the *really* obvious cases, it's not nearly enough, since there tends to be very limited filesizes anyway.

What we could also do is to pass in the minimum similarity score, and use that to at least exit early. We currently pass in "delta_limit" which is close, but we never use it, and we really probably would be better off passing in the minimum score itself and perhaps be able to exit early from diffcore_count_changes.

However, while I did think about doing that, I came to the conclusion that we'd still always end up having to look at least at *half* the hash data (for the default 50% score), so while it would help, it again wouldn't be a matter of orders-of-magnitudes, and it looked like the end result would be unnecessarily complex too.

The best option, of course, would be to use a similarity hash to make the initial choice. I think we had one at one point, but it wasn't fine-grained enough. But it might be interesting to do that as a filter in *front* of the more expensive diffcore_count_changes() call.

We had some "similarity fingerprint" code at some point using a Rabin polynomial. It wasn't reliable enough to be used as a direct score, but maybe it can be used as a first-line "we know this isn't even worth doing the expensive stuff on".

			Linus
Previous: Jeff KingNext: David Kastrup
Message 29 of 44 in “What's cooking in git.git (topics)”
  1. Junio C HamanoSep 6, 2007
  2. Shawn O. PearceSep 14, 2007
  3. Shawn O. PearceSep 15, 2007
  4. Shawn O. PearceSep 16, 2007
  5. Johannes SchindelinSep 14, 2007
  6. Carlos RicaSep 26, 2007
  7. Junio C HamanoSep 26, 2007
  8. Johannes SchindelinSep 26, 2007
  9. Tom ClarkeSep 26, 2007
  10. Jeff KingSep 27, 2007
  11. David KastrupSep 27, 2007
  12. David KastrupSep 27, 2007
  13. Jeff KingSep 27, 2007
  14. David KastrupSep 27, 2007
  15. Jeff KingOct 2, 2007
  16. Junio C HamanoOct 2, 2007
  17. Jeff KingOct 2, 2007
  18. Jeff KingOct 2, 2007
  19. David KastrupOct 2, 2007
  20. Jeff KingOct 2, 2007
  21. David KastrupOct 2, 2007
  22. Jeff KingOct 2, 2007
  23. David KastrupOct 2, 2007
  24. Linus TorvaldsOct 3, 2007
  25. Jeff KingOct 3, 2007
  26. Linus TorvaldsOct 3, 2007
  27. David KastrupOct 3, 2007
  28. Jeff KingOct 3, 2007
  29. Linus TorvaldsOct 3, 2007
  30. David KastrupOct 3, 2007
  31. Junio C HamanoOct 4, 2007
  32. Daniel BarkalowSep 28, 2007
  33. Junio C HamanoOct 2, 2007
  34. Steven GrimmOct 2, 2007
  35. Steffen ProhaskaOct 2, 2007
  36. Matthieu MoyOct 2, 2007
  37. Junio C HamanoOct 2, 2007
  38. David KågedalOct 2, 2007
  39. Matthieu MoyOct 2, 2007
  40. Junio C HamanoOct 2, 2007
  41. rebase: make the warning more useful when the work tree is unclean.Junio C Hamano, Oct 3, 2007
  42. Matthieu MoyOct 3, 2007
  43. Johannes SchindelinOct 2, 2007
  44. Daniel BarkalowOct 2, 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.