From 4cb39fcf19b969cdfa042b65d4d0b62a7fd0ba1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Tue, 13 Dec 2022 07:27:10 +0100 Subject: commit: skip already cleared parents in clear_commit_marks_1() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't put clean parents on the pending list, as they and their ancestors don't need any treatment and would be skipped later anyway. This saves the allocation and release of a commit list item in ca. 20% of the cases during a run of the test suite. Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano --- commit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'commit.c') diff --git a/commit.c b/commit.c index 89b8efc611..115347977a 100644 --- a/commit.c +++ b/commit.c @@ -693,8 +693,10 @@ static void clear_commit_marks_1(struct commit_list **plist, if (!parents) return; - while ((parents = parents->next)) - commit_list_insert(parents->item, plist); + while ((parents = parents->next)) { + if (parents->item->object.flags & mark) + commit_list_insert(parents->item, plist); + } commit = commit->parents->item; } -- cgit v1.2.3