All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Carlos Martín Nieto" <cmn@elego.de>
Subject: Re: [PATCH 5/5] reset: update cache-tree data when appropriate
Date: Wed, 7 Dec 2011 08:53:15 +0100	[thread overview]
Message-ID: <201112070853.15364.trast@student.ethz.ch> (raw)
In-Reply-To: <7v62hte1k7.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> Thomas Rast <trast@student.ethz.ch> writes:
> > @@ -84,6 +85,12 @@ static int reset_index_file(const unsigned char *sha1, int reset_type, int quiet
> >  		return error(_("Failed to find tree of %s."), sha1_to_hex(sha1));
> >  	if (unpack_trees(nr, desc, &opts))
> >  		return -1;
> > +
> > +	if (reset_type == MIXED || reset_type == HARD) {
> > +		tree = parse_tree_indirect(sha1);
> > +		prime_cache_tree(&active_cache_tree, tree);
> > +	}
> 
> The basic idea that MIXED or HARD should result in a cache-tree that match
> the tree we just read is sound, but how expensive is prime_cache_tree()? I
> think it reads the same tree once again. Admittedly, the data needed to
> reconstruct the tree is likely to be hot in core, but it may be necessary
> to measure before deciding if this is a good change.

Oh, I just didn't bother with timings because it's the same strategy
that read-tree follows, so I assumed if it was worth it back then, it
should again be a win.

For linux-2.6 as usual and best-of-10:

  git reset            before: 0:00.25real 0.12user 0.11system
	               after:  0:00.28real 0.14user 0.12system

  git reset --hard     before: 0:00.21real 0.13user 0.06system
                       after:  0:00.18real 0.10user 0.07system

So we spend ~30ms of extra user time, at a possible gain of 30% in
future git-commit invocations, as mentioned in the cover letter.  I
think that's worth it :-)

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

  reply	other threads:[~2011-12-07  7:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-06 17:43 [PATCH 0/5] cache-tree revisited Thomas Rast
2011-12-06 17:43 ` [PATCH 1/5] Add test-scrap-cache-tree Thomas Rast
2011-12-06 22:51   ` Junio C Hamano
2011-12-06 17:43 ` [PATCH 2/5] Test the current state of the cache-tree optimization Thomas Rast
2011-12-06 17:43 ` [PATCH 3/5] Refactor cache_tree_update idiom from commit Thomas Rast
2011-12-06 17:43 ` [PATCH 4/5] commit: write cache-tree data when writing index anyway Thomas Rast
2011-12-06 17:43 ` [PATCH 5/5] reset: update cache-tree data when appropriate Thomas Rast
2011-12-06 23:13   ` Junio C Hamano
2011-12-07  7:53     ` Thomas Rast [this message]
2011-12-08 14:15 ` [PATCH 0/5] cache-tree revisited Thomas Rast

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=201112070853.15364.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=cmn@elego.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.