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

Re: Distinguishing FF vs non-FF updates in the reflog?

From
Jeff King <peff@peff.net>
Date
Mar 26, 2021, 07:43 UTC
Message-ID
<YF2Qr/ClD4a3jCUQ@coredump.intra.peff.net>
In-Reply-To
<CAFQ2z_N8tCMZG62rNSY=HoRGuKnfk1W-Y_GOXz3SeaZO6=cWWA@mail.gmail.com>
On Mon, Mar 22, 2021 at 03:40:46PM +0100, Han-Wen Nienhuys wrote:
Show 16 quoted lines
> > I left some numbers in another part of the thread, but IMHO performance
> > isn't that compelling a reason to do this these days, if you are using
> > commit-graphs.
> >
> > Just walking the reflog might be _slightly_ faster, though not
> > necessarily (it depends on whether the depth of the object graph or the
> > depth of the reflog chain is deeper). It might matter more if you are
> > using a more exotic storage scheme, where switching from accessing
> > reflogs to objects implies extra round-trips to a server (e.g., custom
> > storage backends with JGit; I don't know the state of the art in what
> > Google is doing there).
> 
> JGit doesn't currently support commit-graph, so it's hard to predict
> what performance will be like, but isn't commit-graph is keyed by
> SHA1? That makes it hard to do caching, especially when considering
> large repositories.

Yes, it's keyed by sha1. It's essentially replacing "inflate the commit object and parse it" with "here are the parsed values as mmap-able 32-bit integer fields" (there's some other stuff with generation numbers, too, but the main speedup is simply that accessing each commit is orders of magnitude cheaper).

It caches well, because those properties of the commit are immutable. But if you meant "when pulling data from the commit-graph file, is it friendly to block cache", then no, it's not linear. You'd binary search within it to find each commit, just as you would a pack .idx (and just like a .idx, I'd expect a system that is pulling data from a network source to want to grab the whole commit-graph file. They tend to be much smaller than the main .idx for a given repo).

> AFAIU, commit-graph would help speed up reachability checks, by being
> able to shortcut cases where the commit number proves that some commit
> is not ancestor of the other, but you still have to do a revwalk to
> conclusively prove reachability.

Right. You'll still walk a lot of the commits, but you'll do so much faster (the generation numbers can also help prune some uninteresting side paths, but again, I think the main value for this operation is just getting the parent info much faster).

-Peff
Previous: Han-Wen NienhuysNext: Ævar Arnfjörð Bjarmason
Message 12 of 19 in “Distinguishing FF vs non-FF updates in the reflog?”
  1. Han-Wen NienhuysMar 17, 2021
  2. Martin FickMar 17, 2021
  3. Han-Wen NienhuysMar 18, 2021
  4. Jeff KingMar 18, 2021
  5. Martin FickMar 18, 2021
  6. Han-Wen NienhuysMar 22, 2021
  7. Martin FickMar 22, 2021
  8. Martin FickMar 18, 2021
  9. Jeff KingMar 18, 2021
  10. Jeff KingMar 18, 2021
  11. Han-Wen NienhuysMar 22, 2021
  12. Jeff KingMar 26, 2021
  13. Ævar Arnfjörð BjarmasonMar 22, 2021
  14. Han-Wen NienhuysMar 22, 2021
  15. Ævar Arnfjörð BjarmasonMar 22, 2021
  16. Han-Wen NienhuysMar 22, 2021
  17. Ævar Arnfjörð BjarmasonMar 22, 2021
  18. Han-Wen NienhuysMar 22, 2021
  19. Junio C HamanoMar 22, 2021

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.