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 <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2022-12-13 07:27:10 +01:00 committed by Junio C Hamano
parent 8706a59933
commit 4cb39fcf19

View File

@ -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;
}