Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH v2 1/4] commit.c: add clear_commit_marks_many()

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:19

Jeff King [off-list ref] writes:
On Tue, Mar 05, 2013 at 02:47:16PM -0800, Junio C Hamano wrote:
quoted
clear_commit_marks(struct commit *, unsigned) only can clear flag
bits starting from a single commit; introduce an API to allow
feeding an array of commits, so that flag bits can be cleared from
commits reachable from any of them with a single traversal.
Out of curiosity, is that actually measurably more efficient?

Since we stop traversing a commit's parents when we see it does not have
any of the flags we are clearing, we should visit most commits once. The
exception is ones that we hit by multiple paths. But that should
be the same whether it is done as part of a single traversal or
multiple; in each case, we hit the commit and say "Oh, already cleared;
do not add it to the parents list".

So I would expect it to have little to no impact on performance.  I
still think it is a sane interface change; I was just curious from the
commit message whether there could be a performance impact.
I agree that the log message should end with "with a single API
call." to clarify that this is more about eliminating the code
overhead (the caller having to loop over an array of things) than
about runtime overhead.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help