All of lore.kernel.org
 help / color / mirror / Atom feed
From: bdowning@lavos.net (Brian Downing)
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 0/2] Speed up xdiff_outf, and therefore git blame
Date: Wed, 13 Aug 2008 02:04:01 -0500	[thread overview]
Message-ID: <20080813070401.GA4396@lavos.net> (raw)

When using git gui blame on some files in one of my repositories, and
noticing some rather depressing performance, I decided to look for some
low-hanging fruit to optimize.

I found that a lot of the time is spent in xdiff_outf continually
xreallocing and freeing memory for a string.  I decided to replace that
with a strbuf.  Unfortunately this now means that there are resources
that need to be freed after using xdiff_outf, so a new interface for
doing that needed to be created first.

The performance difference on my repository is not amazing, but quite
noticeable.  Before:

:; time git blame -M -C -C -p --incremental server.c >/dev/null
101.52user 0.17system 1:41.73elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+39561minor)pagefaults 0swaps

After:

:; time git blame -M -C -C -p --incremental server.c >/dev/null
80.38user 0.30system 1:20.81elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+50979minor)pagefaults 0swaps

Obviously, it should improve other uses of xdiff_outf as well, though I
doubt many things hit it as hard as blame does.

 [PATCH 1/2] Make xdiff_outf_{init,release} interface
 [PATCH 2/2] Use strbuf for struct xdiff_emit_state's remainder

 builtin-blame.c   |    4 ++--
 combine-diff.c    |    4 ++--
 diff.c            |   20 ++++++++++----------
 xdiff-interface.c |   44 ++++++++++++++++++++++----------------------
 xdiff-interface.h |    6 ++++--
 5 files changed, 40 insertions(+), 38 deletions(-)

-bcd

                 reply	other threads:[~2008-08-13  7:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080813070401.GA4396@lavos.net \
    --to=bdowning@lavos.net \
    --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.