git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>,
	 "D. Ben Knoble" <ben.knoble@gmail.com>,
	Jeff King <peff@peff.net>,
	 Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v2] diff-index: don't queue unchanged filepairs with diff_change()
Date: Sun, 30 Nov 2025 10:02:19 -0800	[thread overview]
Message-ID: <xmqq5xarcsb8.fsf@gitster.g> (raw)
In-Reply-To: <aa28974b-ec73-4562-bfc8-4745ad58b55a@web.de> ("René Scharfe"'s message of "Sun, 30 Nov 2025 12:47:17 +0100")

René Scharfe <l.s.r@web.de> writes:

> Add a new streamlined function for queuing unchanged filepairs and
> use it in show_modified(), which is called by diff_cache() via
> oneway_diff() and do_oneway_diff().  It allocates only a single filespec
> for each filepair and uses it twice with reference counting.  This has a
> measurable effect if there are a lot of them, like in the Linux repo:
>
> Benchmark 1: ./git_v2.52.0 -C ../linux diff --cached --find-copies-harder
>   Time (mean ± σ):      31.8 ms ±   0.2 ms    [User: 24.2 ms, System: 6.3 ms]
>   Range (min … max):    31.5 ms …  32.3 ms    85 runs
>
> Benchmark 2: ./git -C ../linux diff --cached --find-copies-harder
>   Time (mean ± σ):      23.9 ms ±   0.2 ms    [User: 18.1 ms, System: 4.6 ms]
>   Range (min … max):    23.5 ms …  24.4 ms    111 runs
>
> Summary
>   ./git -C ../linux diff --cached --find-copies-harder ran
>     1.33 ± 0.01 times faster than ./git_v2.52.0 -C ../linux diff --cached --find-copies-harder

Nice.  Is this technique only applicable to diff-index among the
three diff plumbing siblings?  I suspect diff-files is an oddball
in that on the working tree side we do not necessarily have the
blob object names, but it would apply to diff-tree, wouldn't it?

Will queue.  Thanks.

  reply	other threads:[~2025-11-30 18:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-30 11:47 [PATCH v2] diff-index: don't queue unchanged filepairs with diff_change() René Scharfe
2025-11-30 18:02 ` Junio C Hamano [this message]
2025-12-02 21:16   ` René Scharfe
2025-12-02 22:07   ` René Scharfe
2025-12-03 15:06     ` René Scharfe

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=xmqq5xarcsb8.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    /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).