* [PATCH] show-branch: Fix another performance problem.
@ 2006-07-23 17:51 Alexandre Julliard
2006-07-24 6:46 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Julliard @ 2006-07-23 17:51 UTC (permalink / raw)
To: git
When naming commits, stop walking the parent chain as soon as we find
a commit that already has a name. The parent chain of that commit will
be walked later on in any case (or may even have been walked already).
This avoids O(n^2) behavior; on a tree where show-branch displays 6800
commits, the total run time drops from 77 seconds to 5 seconds.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
builtin-show-branch.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 3d240ca..82f75b7 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -89,6 +89,8 @@ static int name_first_parent_chain(struc
name_parent(c, p);
i++;
}
+ else
+ break;
c = p;
}
return i;
--
1.4.2.rc1.ge7a0
--
Alexandre Julliard
julliard@winehq.org
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] show-branch: Fix another performance problem.
2006-07-23 17:51 [PATCH] show-branch: Fix another performance problem Alexandre Julliard
@ 2006-07-24 6:46 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2006-07-24 6:46 UTC (permalink / raw)
To: Alexandre Julliard; +Cc: git
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-07-24 6:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-23 17:51 [PATCH] show-branch: Fix another performance problem Alexandre Julliard
2006-07-24 6:46 ` Junio C Hamano
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).