All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Jeff King <peff@peff.net>,
	 "D. Ben Knoble" <ben.knoble@gmail.com>,
	 Git <git@vger.kernel.org>,
	 Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v2] diff: disable rename detection with --quiet
Date: Sat, 22 Nov 2025 23:09:22 -0800	[thread overview]
Message-ID: <xmqqpl99z0m5.fsf@gitster.g> (raw)
In-Reply-To: <8cc12ef2-1d2c-4924-b130-bd740a975ce0@web.de> ("René Scharfe"'s message of "Sat, 22 Nov 2025 22:44:59 +0100")

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

> --- >8 ---
> Subject: [PATCH] diff-index: don't queue unchanged filepairs with diff_change()
>
> diff_cache() queues unchanged filepairs if the flag find_copies_harder
> is set, and uses diff_change() for that.  This function does a few
> things that are unnecessary for unchanged filepairs and always sets the
> diff_flag has_changes, which is simply misleading in this case.
>
> 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 one half of each
> filepair, ...

It's a misleading thing to say.  It allocates a full filepair, but
because a filespec is reference counted, it can reuse the same
filespec to hold both preimage and postimage, halving the memory
requirement without leading to double freeing.  And having a
separete helper do so would make it almost trivial to avoid setting
the has_changes bit.

Cleverly done.

Thanks.

> ... which has a measurable effect if there are a lot of them, like
> in the Linux repo:

      reply	other threads:[~2025-11-23  7:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-08 19:05 diff --cached --no-ext-diff --find-copies-harder --quiet exits with wrong status code D. Ben Knoble
2025-11-08 19:08 ` D. Ben Knoble
2025-11-08 19:12   ` D. Ben Knoble
2025-11-09 12:11 ` [PATCH] diff: disabled quick optimization with --find-copies-harder René Scharfe
2025-11-09 14:18   ` Phillip Wood
2025-11-09 16:43     ` René Scharfe
2025-11-09 16:43 ` [PATCH v2] diff: disable rename detection with --quiet René Scharfe
2025-11-09 17:34   ` D. Ben Knoble
2025-11-09 18:35     ` René Scharfe
2025-11-10 23:58       ` D. Ben Knoble
2025-11-10  9:42     ` Phillip Wood
2025-11-10 17:54   ` Jeff King
2025-11-10 19:13     ` Junio C Hamano
2025-11-22 21:44     ` René Scharfe
2025-11-23  7:09       ` Junio C Hamano [this message]

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=xmqqpl99z0m5.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 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.