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

Re: Why does send-pack call pack-objects for all remote refs?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 14, 2015, 22:31 UTC
Message-ID
<20151214223155.GA6594@google.com>
In-Reply-To
<20151214210429.GC14788@sigill.intra.peff.net>
Jeff King wrote:
Show 11 quoted lines
> Hmm. I guess that makes sense. The bitmap we want is the set difference
> between the objects we are sending, and the tips the other side has. If
> we have a bitmap at each ref tip, that's very fast. But if you have a
> very large number of refs, we don't make one for each ref, and it has to
> fallback to walking to the nearest one (and it ends up worse than a
> regular walk, because it's filling in the bitmap for each tree, rather
> than just doing the "good enough" commit walk that we usually do).
>
> I suspect there's room for improvement in the way we select commits to
> store bitmaps for (so that the average walk is smaller). But it's rather
> tricky; there's not a single constant to change to make it work better.

Git gc and JGit GC differ here. JGit partitions the commits being packed by branch and then runs a selection algorithm on each part. Git runs a selection once on a list of all commits.

Some effects:
- JGit selects more bitmaps, so the gc takes longer and the resulting
  bitmap file is larger (bad)
- JGit is more likely to have bitmaps for the commits involved in
  pushes and fetches (good)
The commit selection code, for reference:

https://eclipse.googlesource.com/jgit/jgit/+/86af34e1/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java#151 https://kernel.googlesource.com/pub/scm/git/git/+/ed1c9977/pack-bitmap-write.c#383

Thoughts? Jonathan

Previous: Jeff KingNext: Jeff King
Message 9 of 10 in “Why does send-pack call pack-objects for all remote refs?”
  1. Daniel KovermanDec 7, 2015
  2. Junio C HamanoDec 7, 2015
  3. Jeff KingDec 7, 2015
  4. Daniel KovermanDec 8, 2015
  5. Jeff KingDec 10, 2015
  6. Nasser GrainawiDec 12, 2015
  7. Daniel KovermanDec 14, 2015
  8. Jeff KingDec 14, 2015
  9. Jonathan NiederDec 14, 2015
  10. Jeff KingDec 14, 2015

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.