@matheusbsbs / matheus-bagliano / commits / f8263c5339
Fork 0

show-branch: Fix another performance problem.

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> Signed-off-by: Junio C Hamano <junkio@cox.net>

Alexandre Julliard committed Jul 23, 2006 at 19:51 UTC f8263c5339fd70ee00b60c37b715c7e46b30a3bf
1 file changed +2
builtin-show-branch.c
+2
@@ -89,6 +89,8 @@ static int name_first_parent_chain(struct commit *c)
89 name_parent(c, p);
90 i++;
91 }
92 + else
93 + break;
94 c = p;
95 }
96 return i;