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

Re: suboptimal behavior of fast-import in some cases with "from"

From
Mike Hommey <mh@glandium.org>
Date
Jul 9, 2015, 05:52 UTC
Message-ID
<20150709055227.GA32360@glandium.org>
In-Reply-To
<20150709050314.GA6013@glandium.org>
On Thu, Jul 09, 2015 at 02:03:15PM +0900, Mike Hommey wrote:
Show 26 quoted lines
> On Mon, Jul 06, 2015 at 03:54:35PM -0700, Junio C Hamano wrote:
> > Mike Hommey <mh@glandium.org> writes:
> > 
> > > One of the first things parse_from does is unconditionally throw away
> > > the tree for the given branch, and then the "from" tree is loaded. So
> > > when the "from" commit is the current head of the branch, that make
> > > fast-import do more work than necessary.
> > 
> > If it is very common that the next commit the input stream wants to
> > create is often on top of the commit that was just created, and if
> > it is very common that the input stream producer knows what the
> > commit object name of the commit that was just created, then
> > optimising for that case does not sound too bad.  It really depends
> > on two factors:
> > 
> >  - How likely is it that other people make the same mistake?
> 
> Looks like the answer is: very. Assuming my quick glance at the code is
> not mistaken, the same mistake is made in at least git-p4.py (yes, the
> one that comes with git), felipec's git-remote-hg, and hg-fast-export,
> and that's 100% of the sample I looked at.
> 
> I won't claim to know what fast-import is doing, not having looked at
> more than the parse_from* functions and the commit message for 4cabf858,
> but it seems plausible this also skips making tree deltas for those
> trees.
It doesn't /seem/ to be the case.
Show 5 quoted lines
> >  - How bad the damage to parse_from() would be if we wanted to
> >    optimize for this case?
> 
> I /think/ it would look like this (untested), which doesn't seem too
> damaging:

It's actually not enough. It does avoid to reread trees, but it doesn't avoid the pack to be closed/reopened.

Mike
Previous: Mike HommeyNext: Mike Hommey
Message 4 of 9 in “suboptimal behavior of fast-import in some cases with "from"”
  1. Mike HommeyJul 6, 2015
  2. Junio C HamanoJul 6, 2015
  3. Mike HommeyJul 9, 2015
  4. Mike HommeyJul 9, 2015
  5. fast-import: Do less work when given "from" matches current branch headMike Hommey, Jul 9, 2015
  6. Junio C HamanoJul 9, 2015
  7. Mike HommeyJul 9, 2015
  8. Junio C HamanoJul 9, 2015
  9. Junio C HamanoJul 9, 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.