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

Re: topological index field for commit objects

From
Jeff King <peff@peff.net>
Date
Jun 29, 2016, 22:30 UTC
Message-ID
<20160629223007.GA4726@sigill.intra.peff.net>
In-Reply-To
<xmqqlh1n1w84.fsf@gitster.mtv.corp.google.com>
On Wed, Jun 29, 2016 at 03:11:39PM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > Yes, though generation numbers can help with more questions (e.g., "what
> > is the merge base").
> 
> Hmm, how?  I have two commits, with generation number 38 and 47,
> respectively.  What generation number does the commit that is the
> merge base of these two commits?
> 
> I know we can say that 38 cannot possibly be a descendant of 47, but
> can we say anything else that is useful?

I don't think it can give you the answer immediately from those values, but in general generation numbers help you bound actual traversals and avoid walking down unproductive paths. So comparing 38 and 47 is not nearly as useful as walking from 47 down to 37 and saying "I know that I cannot possibly reach 38 by walking further".

I haven't thought hard specifically about merge bases computation, so perhaps that is a case that isn't helped at all. It has been a while since I've looked into this, but I recall there were some computations that are hard to improve with bitmaps. I may also simply be mis-remembering; in my patches generations were tightly tied to having a packv4-style cache of commit properties that can be used rather than inflating the commit object itself. That cache helps any time you walk by speeding up the parse_commit() process. But it's a per-commit speedup. It doesn't change the algorithmic complexity of what you're doing.

-Peff
Previous: Junio C HamanoNext: Johannes Schindelin
Message 9 of 31 in “topological index field for commit objects”
  1. Marc StrapetzJun 29, 2016
  2. Junio C HamanoJun 29, 2016
  3. Stefan BellerJun 29, 2016
  4. Junio C HamanoJun 29, 2016
  5. Jeff KingJun 29, 2016
  6. Jakub NarębskiJun 29, 2016
  7. Jeff KingJun 29, 2016
  8. Junio C HamanoJun 29, 2016
  9. Jeff KingJun 29, 2016
  10. Johannes SchindelinJul 5, 2016
  11. Jakub NarębskiJul 5, 2016
  12. Jakub NarębskiJun 30, 2016
  13. Linus TorvaldsJun 30, 2016
  14. Jakub NarębskiJun 30, 2016
  15. Mike HommeyJun 30, 2016
  16. Jeff KingJul 1, 2016
  17. Marc StrapetzJul 1, 2016
  18. Jakub NarębskiJul 1, 2016
  19. Junio C HamanoJul 1, 2016
  20. Jeff KingJul 1, 2016
  21. Jakub NarębskiJul 1, 2016
  22. Jakub NarębskiJul 20, 2016
  23. Jeff KingJul 20, 2016
  24. Jakub NarębskiFeb 4, 2017
  25. Jeff KingFeb 17, 2017
  26. Jakub NarębskiFeb 17, 2017
  27. Stefan BellerJun 29, 2016
  28. Stefan BellerJun 29, 2016
  29. Jeff KingJun 29, 2016
  30. Marc StrapetzJun 29, 2016
  31. Jakub NarębskiJun 29, 2016

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.