Skip to content

Commit 4cb39fc

Browse files
rscharfegitster
authored andcommitted
commit: skip already cleared parents in clear_commit_marks_1()
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8706a59 commit 4cb39fc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

commit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,10 @@ static void clear_commit_marks_1(struct commit_list **plist,
693693
if (!parents)
694694
return;
695695

696-
while ((parents = parents->next))
697-
commit_list_insert(parents->item, plist);
696+
while ((parents = parents->next)) {
697+
if (parents->item->object.flags & mark)
698+
commit_list_insert(parents->item, plist);
699+
}
698700

699701
commit = commit->parents->item;
700702
}

0 commit comments

Comments
 (0)