git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] commit: skip already cleared parents in clear_commit_marks_1()

From
René Scharfe <l.s.r@web.de>
Date
Dec 13, 2022, 06:27 UTC
Message-ID
<7cf2ea1f-8dbf-5639-3874-86de391ae20a@web.de>

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
Next: Derrick Stolee
Message 1 of 2 in “commit: skip already cleared parents in clear_commit_marks_1()”
  1. commit: skip already cleared parents in clear_commit_marks_1()René Scharfe, Dec 13, 2022
  2. Derrick StoleeDec 15, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.