From: Jeff King <peff@peff.net>
To: David Turner <dturner@twopensource.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Elijah Newren <newren@gmail.com>,
git mailing list <git@vger.kernel.org>
Subject: Re: git reset for index restoration?
Date: Thu, 22 May 2014 15:30:30 -0400 [thread overview]
Message-ID: <20140522193030.GA22383@sigill.intra.peff.net> (raw)
In-Reply-To: <20140522190959.GA18785@sigill.intra.peff.net>
[+cc Junio for cache-tree expertise]
On Thu, May 22, 2014 at 03:09:59PM -0400, Jeff King wrote:
> > > does show some improvement. Perhaps "git reset" is not writing out the
> > > cache-tree extension?
> [...]
>
> Possibly. There is a call to prime_cache_tree in builtin/reset.c, which
> looks like it should trigger during a "mixed" or "hard" reset (and
> without arguments, you should have a mixed reset). But it doesn't seem
> to get called. I haven't traced it further.
So here's what's happening. The prime_cache_tree call is in reset_index,
and was added by:
commit 6c52ec8a9ab48b50fc8bf9559467d5a4cf7eee3b
Author: Thomas Rast <trast@student.ethz.ch>
Date: Tue Dec 6 18:43:39 2011 +0100
reset: update cache-tree data when appropriate
In the case of --mixed and --hard, we throw away the old index and
rebuild everything from the tree argument (or HEAD). So we have an
opportunity here to fill in the cache-tree data, just as read-tree
did.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
But that was counteracted by:
commit 3fde386a40f38dbaa684c17603e71909b862d021
Author: Martin von Zweigbergk <martinvonz@gmail.com>
Date: Mon Jan 14 21:47:51 2013 -0800
reset [--mixed]: use diff-based reset whether or not pathspec was given
Thanks to b65982b (Optimize "diff-index --cached" using cache-tree,
2009-05-20), resetting with paths is much faster than resetting
without paths. Some timings for the linux-2.6 repo to illustrate this
(best of five, warm cache):
reset reset .
real 0m0.219s 0m0.080s
user 0m0.140s 0m0.040s
sys 0m0.070s 0m0.030s
These two commands should do the same thing, so instead of having the
user type the trailing " ." to get the faster do_diff_cache()-based
implementation, always use it when doing a mixed reset, with or
without paths (so "git reset $rev" would also be faster).
Timing "git reset" shows that it indeed becomes as fast as
"git reset ." after this patch.
Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We never call reset_index now, because we handle it via diff. We could
call prime_cache_tree in this case, but I'm not sure if that is a good
idea, because it primes it from scratch (and so it opens up all those
trees that we are trying to avoid touching). I'm not sure if there's an
easy way to update it incrementally; I don't know the cache-tree code
very well.
-Peff
next prev parent reply other threads:[~2014-05-22 19:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 16:22 git reset for index restoration? David Turner
2014-05-22 16:46 ` Jeff King
2014-05-22 18:08 ` David Turner
2014-05-22 18:23 ` Jeff King
2014-05-22 19:26 ` David Turner
2014-05-22 16:46 ` Elijah Newren
2014-05-22 18:17 ` David Turner
2014-05-22 18:39 ` Jeff King
2014-05-22 19:07 ` David Turner
2014-05-22 19:09 ` Jeff King
2014-05-22 19:30 ` Jeff King [this message]
2014-05-22 21:34 ` Junio C Hamano
2014-05-22 21:53 ` David Turner
2014-05-22 21:58 ` Junio C Hamano
2014-05-22 22:01 ` David Turner
2014-05-22 22:12 ` Junio C Hamano
2014-05-22 22:18 ` Junio C Hamano
2014-05-22 23:33 ` Duy Nguyen
2014-05-22 23:37 ` David Turner
2014-05-22 22:29 ` Junio C Hamano
2014-05-22 23:02 ` David Turner
2014-05-22 23:14 ` Junio C Hamano
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=20140522193030.GA22383@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).