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

Re: small question about the repack algorithm

From
Pierre Habouzit <madcoder@debian.org>
Date
Feb 8, 2008, 08:38 UTC
Message-ID
<20080208083858.GA24913@artemis.madism.org>
In-Reply-To
<7vodarly4z.fsf@gitster.siamese.dyndns.org>
On Fri, Feb 08, 2008 at 07:12:44AM +0000, Junio C Hamano wrote:
Show 33 quoted lines
> Pierre Habouzit <madcoder@debian.org> writes:
> 
> >   I've trying to see if that optimization was used but I was somehow
> > unable to find if it was the case, as the code is a bit tough :)
> >
> >   I was wondering if the repacking window was using triangle inequality
> > to discard trying some costly deltas (I assume that what costs the most
> > in the repacking is computing the delta). I mean, if you consider the
> > "size" of a delta, I'm almost sure that it's very near a distance.
> >
> >   So assuming that we know the delta sizes between any pair of reference
> > objects in the window, well, if an object we want to delta against the
> > window Od are near one reference O1 enough, for each Oi in the window
> > that holds: len(δ(O1, Oi)) > 2 * len(δ(Od, O1)), then it's not worth
> > investigating.
> 
> We do not keep track of the delta size matrix between delta-base
> candidates in the window, but I presume we could.  The storage
> cost for doing so is very cheap (window^2 * size_t).  But we do
> not even compute the distance matrix fully (I'll mention the
> reason why the above is not (window^2 * size_t / 2) later).
> 
>     1-----------------------------i   <= delta-base candidates
>      \
>       \ 
>        D <-- the target we are considering
> 
> Your idea is that if we want to find the cheapest delta-base,
> and after we find out that candidate #1 is close to our target D
> and candidate #i is very far from candidate #1, then delta to
> create D using candidate #i as the base would be much bigger.
> If the distance space is Euclidean, that would be a nice
> optimization.
  Well, Euclidean is too much, a simple Metric Space is enough IIRC.
> The second reason is that the deltification is not symmetric.
> If you define the "distance" between #1 and #i as "the size of
> delta to reproduce #i using #1 as base", the distance between #1
> and #i is very different from the distance between #i and #1.
  Well that's the most obvious reason indeed and I totally missed that,
dang. The delta is not near a distance enough. Too bad :)
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Junio C Hamano
Message 3 of 3 in “small question about the repack algorithm”
  1. Pierre HabouzitFeb 7, 2008
  2. Junio C HamanoFeb 8, 2008
  3. Pierre HabouzitFeb 8, 2008

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.