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

Re: [RFC] pack-objects: compression level for non-blobs

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Dec 30, 2012, 12:53 UTC
Message-ID
<CACsJy8C4UttGKcw11do1POcHZJM7iZ2r7F3ESOqEnWL8kdz+dQ@mail.gmail.com>
In-Reply-To
<20121230120542.GA10820@sigill.intra.peff.net>
On Sun, Dec 30, 2012 at 7:05 PM, Jeff King <peff@peff.net> wrote:
> So I was thinking about this, which led to some coding, which led to
> some benchmarking.

I like your way of thinking! May I suggest you take a new year break first, then "think" about reachability bitmaps ;-) 2013 will be an exciting year.

Show 18 quoted lines
> I want to clean up a few things in the code before I post it, but the
> general idea is to have arbitrary per-pack cache files in the
> objects/pack directory. Like this:
>
>   $ cd objects/pack && ls
>   pack-a3e262f40d95fc0cc97d92797ff9988551367b75.commits
>   pack-a3e262f40d95fc0cc97d92797ff9988551367b75.idx
>   pack-a3e262f40d95fc0cc97d92797ff9988551367b75.pack
>   pack-a3e262f40d95fc0cc97d92797ff9988551367b75.parents
>   pack-a3e262f40d95fc0cc97d92797ff9988551367b75.timestamps
>   pack-a3e262f40d95fc0cc97d92797ff9988551367b75.trees
>
> Each file describes the objects in the matching pack. If a new pack is
> generated, you'd throw away the old cache files along with the old pack,
> and generate new ones. Or not. These are totally optional, and an older
> version of git will just ignore them. A newer version will use them if
> they're available, and otherwise fallback to the existing code (i.e.,
> reading the whole object from the pack). So you can generate them at

You have probably thought about this (and I don't have the source to check first), but we may need to version these extra files so we can change the format later if needed. Git versions that do not recognize new versions simply ignore the cahce.

> repack time, later on, or not at all. For now I have a separate command
> that generates them based on the pack index; if this turns out to be a
> good idea, it would probably get called as part of "repack".

I'd like to make it part of index-pack, where we have nearly everything in memory. But let's leave it as a separate command first.

> Each file is a set of fixed-length records. The "commits" file contains
> the sha1 of every commit in the pack (sorted). A binary search of the
> mmap'd file gives the position of a particular commit within the list,

I think we could avoid storing sha-1 in the cache with Shawn's idea [1]. But now I read it again I fail to see it :(

[1] http://article.gmane.org/gmane.comp.version-control.git/206485
Show 7 quoted lines
> Of course, it does very little for the full --objects listing, where we
> spend most of our time inflating trees. We could couple this with
> uncompressed trees (which are not all that much bigger, since the sha1s
> do not compress anyway). Or we could have an external tree cache, but
> I'm not sure exactly what it would look like (this is basically
> reinventing bits of packv4, but doing so in a way that is redundant with
> the existing packfile, rather than replacing it).

Depending on the use case, we could just generate packv4-like cache for recently-used trees only. I'm not sure how tree cache impact a merge operation on a very large worktree (iow, a lot of trees referenced from HEAD to be inflated). This is something a cache can do, but a new pack version cannot.

> Or since the point of
> --objects is usually reachability, it may make more sense to pursue the
> bitmap, which should be even faster still.

Yes. And if narrow clone ever comes, which needs --objects limited by pathspec, we could just produce extra bitmaps for frequently-used pathspecs and only allow narrow clone with those pathspecs.

-- 
Duy
Previous: Jeff KingNext: Jeff King
Message 11 of 19 in “[RFC] pack-objects: compression level for non-blobs”
  1. David Michael BarrNov 26, 2012
  2. David Michael BarrNov 26, 2012
  3. Jeff KingDec 29, 2012
  4. Nguyen Thai Ngoc DuyDec 29, 2012
  5. Jeff KingDec 29, 2012
  6. Nguyen Thai Ngoc DuyDec 29, 2012
  7. Jeff KingDec 29, 2012
  8. Jeff KingDec 29, 2012
  9. Jeff KingDec 29, 2012
  10. Jeff KingDec 30, 2012
  11. Nguyen Thai Ngoc DuyDec 30, 2012
  12. Jeff KingDec 30, 2012
  13. Shawn PearceDec 31, 2012
  14. Duy NguyenJan 1, 2013
  15. Duy NguyenJan 1, 2013
  16. Shawn PearceJan 1, 2013
  17. Junio C HamanoJan 1, 2013
  18. Duy NguyenJan 2, 2013
  19. Junio C HamanoJan 1, 2013

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.