git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
Cc: Junio C Hamano <gitster@pobox.com>,
	Paul Mackerras <paulus@samba.org>,
	Git Mailing List <git@vger.kernel.org>,
	Pierre Habouzit <madcoder@debian.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 2/2] --pretty=format: on-demand format expansion
Date: Fri, 9 Nov 2007 19:46:37 -0500	[thread overview]
Message-ID: <20071110004635.GA14992@sigill.intra.peff.net> (raw)
In-Reply-To: <4734EA4E.8070405@lsrfire.ath.cx>

On Sat, Nov 10, 2007 at 12:16:30AM +0100, René Scharfe wrote:

> > A partial patch on top of yours is below (it caches commit and tree 
> > abbreviations; parent abbreviations and person-parsing are probably 
> > worth doing). Some timings:
> 
> ... but I object to the choice of items to cache.  Are there real-world
> formats containing the same placeholder twice or even more often?

My choice of items was more "here is what I am talking about" and not
"this is the best set of items."

As for what real-world workloads are like, part of the _point_ of
--pretty=format: is for one-off formats that users use in their
workflow. So yes, I have used formats that repeat specifiers, but they
are probably not common.

The point of my timings was to show not only that we sped up that
uncommon case, but that there was negligible cost to the common case.
And since we don't know what formats users will provide, it makes sense
not to have lousy performance on the uncommon.

> There is probably more to gain from the interdependencies of different
> placeholders.  The patch below attempts to avoid parsing the commit
> twice, by saving pointers to the different parts.

Looks sane, although I don't see any reason this couldn't just go on top
of my patch, and then we can speed up both cases.

> (next)
> $ time git log --pretty=format:"* %cd %cn%n%n%s%n%b" >/dev/null
> real    0m0.631s
[...]
> (next+patch)
> $ time git log --pretty=format:"* %cd %cn%n%n%s%n%b" >/dev/null
> real    0m0.570s

Great, you have sped up the uncommon case. But what is the cost to "git
log --pretty=format:" and "git log --pretty=format:%cd"?

-Peff

  parent reply	other threads:[~2007-11-10  0:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09  0:49 [PATCH 2/2] --pretty=format: on-demand format expansion René Scharfe
2007-11-09  1:24 ` Johannes Schindelin
2007-11-09 21:13   ` René Scharfe
2007-11-09 22:18     ` Johannes Schindelin
2007-11-09 22:30       ` Junio C Hamano
2007-11-09  4:50 ` Jeff King
2007-11-09 23:16   ` René Scharfe
2007-11-10  0:31     ` Johannes Schindelin
2007-11-10  0:49       ` Jeff King
2007-11-10  0:46     ` Jeff King [this message]
2007-11-10 11:12       ` René Scharfe
2007-11-10 16:07         ` Johannes Schindelin
2007-11-10 16:24           ` René Scharfe
2007-11-10 20:36           ` Jeff King
2007-11-10 20:34         ` Jeff King
2007-11-11  8:13           ` Jeff King
2007-11-10 11:14       ` [PATCH 1/3] --pretty=format: parse commit message only once René Scharfe
2007-11-10 11:16       ` [PATCH 2/3] add strbuf_adddup() René Scharfe
2007-11-10 11:18       ` [PATCH 3/3] --format=pretty: avoid calculating expensive expansions twice René Scharfe
2007-11-11 10:29         ` Junio C Hamano
2007-11-09  4:52 ` [PATCH 2/2] --pretty=format: on-demand format expansion Jeff King
2007-11-09 23:20   ` René Scharfe
2007-11-10  0:51     ` Jeff King
2007-11-09 23:39 ` Paul Mackerras

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=20071110004635.GA14992@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madcoder@debian.org \
    --cc=paulus@samba.org \
    --cc=rene.scharfe@lsrfire.ath.cx \
    /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).