git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] commit: skip already cleared parents in clear_commit_marks_1()
@ 2022-12-13  6:27 René Scharfe
  2022-12-15 15:13 ` Derrick Stolee
  0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2022-12-13  6:27 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

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 <l.s.r@web.de>
---
 commit.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/commit.c b/commit.c
index 572301b80a..d00780bee5 100644
--- a/commit.c
+++ b/commit.c
@@ -701,8 +701,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;
 	}
--
2.38.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-15 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-13  6:27 [PATCH] commit: skip already cleared parents in clear_commit_marks_1() René Scharfe
2022-12-15 15:13 ` Derrick Stolee

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).