All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frans Pop <elendil@planet.nl>
To: Petr Baudis <pasky@suse.cz>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: Testing if a certain commit is in the current branch
Date: Wed, 27 Jan 2010 16:27:44 +0100	[thread overview]
Message-ID: <201001271627.45715.elendil@planet.nl> (raw)
In-Reply-To: <20100127150834.GG9553@machine.or.cz>

On Wednesday 27 January 2010, Petr Baudis wrote:
> > Great! If the commit ID is not present that only takes 1 sec versus 11
> > secs for my test. (If the commit _is_ present and fairly recent my
> > test can be faster, but 11 secs delay when it's not present hurts
> > more.)
>
> Isn't something very wrong if grepping the log output is faster than
> simple merge-base call? Can you post exact numbers?

It's only faster if the commit is present very early in the log.
The reason is probably that because of the '-q' option it does not actually 
read the full log, but breaks out as soon as it's found a match.

In my test I had an elapsed time of ~0.5 sec (versus 1 sec for Junio's 
test). And here's a grep for the very first commit:

$ time git log --pretty=format:%H | grep -q 48404cb50b0b547

real    0m0.010s
user    0m0.000s
sys     0m0.012s

  reply	other threads:[~2010-01-27 15:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27  7:19 Testing if a certain commit is in the current branch Frans Pop
2010-01-27  7:24 ` Junio C Hamano
2010-01-27  8:36   ` Frans Pop
2010-01-27 10:19     ` Jonathan Nieder
2010-01-27 13:26       ` Frans Pop
2010-01-27 15:15         ` Dale Farnsworth
2010-01-27 15:39           ` Frans Pop
2010-01-27 15:08     ` Petr Baudis
2010-01-27 15:27       ` Frans Pop [this message]
2010-01-27  8:26 ` Matthieu Moy
2010-01-27  8:47   ` Frans Pop
2010-01-27  8:56 ` Johannes Schindelin

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=201001271627.45715.elendil@planet.nl \
    --to=elendil@planet.nl \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pasky@suse.cz \
    /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.