From: Junio C Hamano <gitster@pobox.com>
To: "SZEDER Gábor" <szeder.dev@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/4] line-log: avoid unnecessary tree diffs when processing merge commits
Date: Mon, 25 Aug 2025 08:35:53 -0700 [thread overview]
Message-ID: <xmqqms7ntnvq.fsf@gitster.g> (raw)
In-Reply-To: <20250824190644.2573279-2-szeder.dev@gmail.com> ("SZEDER Gábor"'s message of "Sun, 24 Aug 2025 21:06:41 +0200")
SZEDER Gábor <szeder.dev@gmail.com> writes:
> @@ -1209,7 +1202,6 @@ static int process_ranges_ordinary_commit(struct rev_info *rev, struct commit *c
> static int process_ranges_merge_commit(struct rev_info *rev, struct commit *commit,
> struct line_log_data *range)
> {
> - struct diff_queue_struct *diffqueues;
> struct line_log_data **cand;
> struct commit **parents;
> struct commit_list *p;
> @@ -1220,20 +1212,19 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
> if (nparents > 1 && rev->first_parent_only)
> nparents = 1;
>
> - ALLOC_ARRAY(diffqueues, nparents);
> CALLOC_ARRAY(cand, nparents);
> ALLOC_ARRAY(parents, nparents);
>
> p = commit->parents;
> for (i = 0; i < nparents; i++) {
> + struct diff_queue_struct diffqueue = DIFF_QUEUE_INIT;
> + int changed;
> parents[i] = p->item;
> p = p->next;
> - queue_diffs(range, &rev->diffopt, &diffqueues[i], commit, parents[i]);
> - }
> + queue_diffs(range, &rev->diffopt, &diffqueue, commit, parents[i]);
>
> - for (i = 0; i < nparents; i++) {
> - int changed;
> - changed = process_all_files(&cand[i], rev, &diffqueues[i], range);
> + changed = process_all_files(&cand[i], rev, &diffqueue, range);
> + diff_queue_clear(&diffqueue);
> if (!changed) {
> /*
> * This parent can take all the blame, so we
This is surprisingly small change that eliminates quite a lot of
waste. Nicely done.
> @@ -1267,7 +1258,6 @@ static int process_ranges_merge_commit(struct rev_info *rev, struct commit *comm
> free(cand[i]);
> }
> free(cand);
> - free_diffqueues(nparents, diffqueues);
> return ret;
>
> /* NEEDSWORK evil merge detection stuff */
next prev parent reply other threads:[~2025-08-25 15:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-24 19:06 [PATCH 0/4] line-log: optimize merge commit processing SZEDER Gábor
2025-08-24 19:06 ` [PATCH 1/4] line-log: avoid unnecessary tree diffs when processing merge commits SZEDER Gábor
2025-08-25 14:13 ` Derrick Stolee
2025-08-25 15:35 ` Junio C Hamano [this message]
2025-08-28 20:27 ` SZEDER Gábor
2025-08-24 19:06 ` [PATCH 2/4] line-log: get rid of the parents array in process_ranges_merge_commit() SZEDER Gábor
2025-08-24 19:06 ` [PATCH 3/4] line-log: initialize diff queue in process_ranges_ordinary_commit() SZEDER Gábor
2025-08-24 19:06 ` [PATCH 4/4] line-log: simplify condition checking for merge commits SZEDER Gábor
2025-08-25 20:57 ` Junio C Hamano
2025-08-25 21:43 ` Derrick Stolee
2025-08-25 21:57 ` Junio C Hamano
2025-08-25 14:16 ` [PATCH 0/4] line-log: optimize merge commit processing Derrick Stolee
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=xmqqms7ntnvq.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=szeder.dev@gmail.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.