All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Øyvind A. Holm" <sunny@sunbase.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Jakub Narębski" <jnareb@gmail.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git-testadd: Execute a command with only the staged changes in Git applied
Date: Fri, 29 Jul 2016 01:17:27 +0200	[thread overview]
Message-ID: <CAA787rnugsnAqK6iH_UZMQRhdpnjJ6NN0x8aaVn7e9GAE88=jQ@mail.gmail.com> (raw)
In-Reply-To: <xmqqzip1pew5.fsf@gitster.mtv.corp.google.com>

On 29 July 2016 at 00:38, Junio C Hamano <gitster@pobox.com> wrote:
> Øyvind A. Holm <sunny@sunbase.org> writes:
> > Jakub Narębski <jnareb@gmail.com> wrote:
> > > I wonder if using `git worktree` instead of `git clone` (well,
> > > local clone uses hardlinks, so it is not that costly as it looks
> > > like) would be a better solution.
> >
> > That's an interesting idea. Have to test it out. This is the result
> > from the current master in linux.git:
> >
> > With clone:
> > ...
> > With worktree:
> > ...
> >
> > Both tests were run with cold cache ("echo 3
> > >/proc/sys/vm/drop_caches" as root). It seems as there's no
> > >difference, and that git clone is as fast as it can get without
> > >breaking physical laws. And we probably shouldn't do that. :)
>
> I expect that writing the 55k+ files in the working tree would
> dominate the cost.  Local clone would make some hardlinks in .git
> (including ones in .git/object/*) but the cost of that would not be
> too high as long as the repository is well packed; "git worktree"
> would reduce that part of the cost from "git clone", but both incur
> the cost of "checkout", i.e. actually populating the new working tree.
>
> Does the test directory even need to look anything like Git?  In other
> words, would it suffice if it resembled the result of running "git
> archive | tar xf -"?  I suspect that it would not make much
> difference, either, for the same reason, though ;-).

Using git archive saved 1.6 seconds:

  $ mkdir testdir; git archive HEAD | (cd testdir && time tar x)

  real    0m8.881s
  user    0m0.440s
  sys     0m2.740s
  $

But when .git is missing in the subdir, git apply doesn't work. Can't
think of any way to get that to work without involving patch(1) and
friends, and then the binary diffs goes out of the window.

But I'm quite satisfied with 10.4 seconds with cold diskcache and >55K
files. Very impressive, actually.

- Øyvind

      parent reply	other threads:[~2016-07-28 23:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-28 16:20 git-testadd: Execute a command with only the staged changes in Git applied Øyvind A. Holm
     [not found] ` <xmqqlh0lsoq6.fsf@gitster.mtv.corp.google.com>
2016-07-28 16:56   ` Øyvind A. Holm
2016-07-28 19:31     ` Jakub Narębski
2016-07-28 22:31       ` Øyvind A. Holm
     [not found]         ` <xmqqzip1pew5.fsf@gitster.mtv.corp.google.com>
2016-07-28 23:17           ` Øyvind A. Holm [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA787rnugsnAqK6iH_UZMQRhdpnjJ6NN0x8aaVn7e9GAE88=jQ@mail.gmail.com' \
    --to=sunny@sunbase.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.