git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Frans Pop <elendil@planet.nl>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	git@vger.kernel.org
Subject: Re: Re*: Extremely slow progress during 'git reflog expire --all'
Date: Thu, 8 Apr 2010 03:00:50 -0400	[thread overview]
Message-ID: <20100408070050.GG30473@coredump.intra.peff.net> (raw)
In-Reply-To: <7vk4sjcddh.fsf@alter.siamese.dyndns.org>

On Wed, Apr 07, 2010 at 11:43:22AM -0700, Junio C Hamano wrote:

> Side note.
> 
> It may be an improvement to dig the history even more incrementally.

I doubt it matters much in practice. The important features of the
solution are:

  - for most refs, which are either all-reachable or which don't have
    clock skew, don't go to the roots at all. This is the fast case that
    we should do most of the time.

  - for others, don't go to the roots over and over for each entry. This
    is the slow case, but we just need to make sure it's a not the
    horrible slow case that Frans saw.

Your suggestion speeds up the slow case a little bit, but it is already
acceptably fast. Plus this is an optimistic optimization. There are
still cases where you might have to dig to the roots anyway (e.g.,
whenever you have anything unreachable).

> Inside unreachable(), we currently dig immediately down to root, but it
> may give us a better performance in a long history with reflog entries
> that wildly jump everywhere in that history if we dug down to the
> timestamp of the commit we are looking at.  A patch to do so on top of the
> previous one may look like this.

Why dig to the timestamp? You know you're looking for a particular
commit, so you can dig down to that commit. If it's reachable, stop
there and you have your answer. Any work you do beyond that might be
used for a further entry lookup, but it might not at all. If it's not
reachable, then you're going to end up digging down to the roots anyway.

With an unreachable ref and your scheme, you would just end up not
finding it, extending again, not finding it, extending again, etc. But
you can never be sure it's truly unreachable without going to the roots
or assuming no clock skew, so that is what we'll end up doing.

-Peff

  reply	other threads:[~2010-04-08  7:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-02 19:54 Extremely slow progress during 'git reflog expire --all' Frans Pop
2010-04-02 21:28 ` Jeff King
2010-04-02 21:50   ` Frans Pop
2010-04-02 22:41     ` Jeff King
2010-04-03 14:29       ` Frans Pop
2010-04-03 20:33         ` Jeff King
2010-04-03 20:35         ` Jeff King
2010-04-04 18:22           ` Junio C Hamano
2010-04-05  6:26             ` Jeff King
2010-04-05 18:54               ` Junio C Hamano
2010-04-06  6:02                 ` Jeff King
2010-04-07 18:39                   ` Re*: " Junio C Hamano
2010-04-07 18:43                     ` Junio C Hamano
2010-04-08  7:00                       ` Jeff King [this message]
2010-04-08  6:52                     ` Jeff King

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=20100408070050.GG30473@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=elendil@planet.nl \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=spearce@spearce.org \
    /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).