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

Re: No progress from push when using bitmaps

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 14, 2014, 23:53 UTC
Message-ID
<CACsJy8BrdN5sbuMEp+G-gUBDcSwFscX_4pYe-U5bOkuq6=J4gw@mail.gmail.com>
In-Reply-To
<20140314152939.GA6186@sigill.intra.peff.net>
On Fri, Mar 14, 2014 at 10:29 PM, Jeff King <peff@peff.net> wrote:
Show 9 quoted lines
>> If an object is reused, we already know its compressed size. If it's
>> not reused and is a loose object, we could use on-disk size. It's a
>> lot harder to estimate an not-reused, deltified object. All we have is
>> the uncompressed size, and the size of each delta in the delta chain..
>> Neither gives a good hint of what the compressed size would be.
>
> Hmm. I think we do have the compressed delta size after having run the
> compression phase (because that is ultimately what we compare to find
> the best delta).

There are cases when we try not to find deltas (large blobs, file too small, or -delta attribute). The large blob case is especially interesting because progress bar crawls slowly when they write these objects.

Show 9 quoted lines
> Loose objects are probably the hardest here, as we
> actually recompress them (IIRC, because packfiles encode the type/size
> info outside of the compressed bit, whereas it is inside for loose
> objects; the "experimental loose" format harmonized this, but it never
> caught on).
>
> Without doing that recompression, any value you came up with would be an
> estimate, though it would be pretty close (not off by more than a few
> bytes per object).

That's my hope. Although if they tweak compression level then the estimation could be off (gzip -9 and gzip -1 produce big difference in size)

Show 10 quoted lines
> However, you can't just run through the packing list
> and add up the object sizes; you'd need to do a real "dry-run" through
> the writing phase. There are probably more I'm missing, but you need at
> least to figure out:
>
>   1. The actual compressed size of a full loose object, as described
>      above.
>
>   2. The variable-length headers for each object based on its type and
>      size.

We could run through a "typical" repo, calculate the average header length then use it for all objects?

Show 6 quoted lines
>
>   3. The final form that the object will take based on what has come
>      before. For example, if there is a max pack size, we may split an
>      object from its delta base, in which case we have to throw away the
>      delta. We don't know where those breaks will be until we walk
>      through the whole list.

Ah this could probably be avoided. max pack size does not apply to streaming pack-objects, where progress bar is most shown. Falling back to object number in this case does not sound too bad.

Show 6 quoted lines
>
>   4. If an object we attempt to reuse turns out to be corrupted, we
>      fall back to the non-reuse code path, which will have a different
>      size. So you'd need to actually check the reused object CRCs during
>      the dry-run (and for local repacks, not transfers, we actually
>      inflate and check the zlib, too, for safety).
Ugh..
Show 7 quoted lines
>
> So I think it's _possible_. But it's definitely not trivial. For now, I
> think it makes sense to go with something like the patch I posted
> earlier (which I'll re-roll in a few minutes). That fixes what is IMHO a
> regression in the bitmaps case. And it does not make it any harder for
> somebody to later convert us to a true byte-counter (i.e., it is the
> easy half already).
Agreed.
-- 
Duy
Previous: Jeff King
Message 10 of 10 in “No progress from push when using bitmaps”
  1. Shawn PearceMar 13, 2014
  2. Jeff KingMar 13, 2014
  3. Shawn PearceMar 13, 2014
  4. Jeff KingMar 13, 2014
  5. Junio C HamanoMar 13, 2014
  6. Jeff KingMar 13, 2014
  7. Michael HaggertyMar 14, 2014
  8. Duy NguyenMar 14, 2014
  9. Jeff KingMar 14, 2014
  10. Duy NguyenMar 14, 2014

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.