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

Re: [PATCH/RFC] index-pack: produce pack index version 3

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Aug 13, 2012, 00:57 UTC
Message-ID
<CACsJy8CNp2w6PsMSrQ4aFBwHKbOGid4pVHUhE4xgmTatrnEepQ@mail.gmail.com>
In-Reply-To
<7vlihjgaaj.fsf@alter.siamese.dyndns.org>
On Mon, Aug 13, 2012 at 2:49 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> For example, the reachability bitmap would want to say something
> like "Traversing from commit A, these objects in this pack are
> reachable."  The bitmap for one commit A would logically consist of
> N bits for a packfile that stores N objects (the resulting bitmap
> needs to be compressed before going to disk, perhaps with RLE or
> something).  With the single "sorted by SHA-1" table, we can use the
> index in that single table to enumerate all reachable objects of any
> type in one go.  With four separate tables, on the other hand, we
> would need four bitmaps per commit.

No we still need one per commit. The n-th bit is in the order of the object in the pack, not the index. How sha-1 is sorted does not matter.

Show 5 quoted lines
> Either way is _possible_, but I think the former is simpler, and the
> latter makes it harder to introduce new types of objects in the
> future, which I do not think we have examined possible use cases
> well enough to make that decision to say "four types is enough
> forever".

New types can be put in one of those four tables, depending on its purpose. The reason I split because I care particularly about commits and trees. If the new type serves the same purpose as tree, for example, then it's better put in tree table...

Show 8 quoted lines
> In either way, we would have such bitmap (or a set of four bitmaps
> in your case) for more than one commit (it is not necessary or
> desirable to add the reachability bitmap to all commits), and such a
> "reachability extension" would need to store a sequence of "the
> commit object name the bitmap (or a set of four bitmaps) is about,
> and the bitmap (or set of four bitmaps)".  That object name does not
> have to be 20-byte but would be a varint representation of the
> offset into the "sorted by SHA-1" table.
How do you reach the bitmap, given its commit sha-1?
Show 10 quoted lines
> That varint representation
> would be smaller by about 3.5 bits if you have a separate "commit
> only, sorted by SHA-1" table (as the number of all objects tend to
> be 10x larger than the number of all commits that need them).  For
> the particular case of "we want to only annotate the commits, never
> other kinds of objects" use case, it would be a win.  But without
> knowing what other use cases we will want to use the "object
> annotation in the pack index file" mechanism for, it feels like a
> premature optimization to me to have four tables to shave 3.5 bits
> per object.

caching trees for faster traversal in general case (sort of pack v4 but it comes as a cache instead of replacing the real pack).

-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 10 in “index-pack: produce pack index version 3”
  1. index-pack: produce pack index version 3Nguyễn Thái Ngọc Duy, Aug 12, 2012
  2. Junio C HamanoAug 12, 2012
  3. Junio C HamanoAug 12, 2012
  4. Nguyen Thai Ngoc DuyAug 13, 2012
  5. Junio C HamanoAug 13, 2012
  6. Shawn PearceAug 14, 2012
  7. Nguyen Thai Ngoc DuyAug 14, 2012
  8. Junio C HamanoAug 16, 2012
  9. Shawn PearceAug 16, 2012
  10. Junio C HamanoAug 16, 2012

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.