Subject: Re: [PATCH 3/2] Avoid unnecessary strlen() calls

From: Junio C Hamano <[email-masked]>
Date: Mon, 19 Mar 2007 20:16:51 -0700

Linus Torvalds <[email-masked]> writes:

> So it looks like it *used* to be somewhat of a problem (the object access 
> itself must have been about 10 seconds, since that got shaved off the 
> time), but realistically, if you want to speed up "git blame", we can 
> totally ignore the git object data structures, an dconcentrate on xdiff 
> and on blame itself (cmp_suspect and assign_blame probably have some nasty 
> O(n^2) behaviour or something like that,...

With this stupidity-removal patch, it gets down to 7.80user from
8.72user (comparable number of minor faults) for blaming
block/ll_rw_blk.c (without tglx grafts)

diff --git a/builtin-blame.c b/builtin-blame.c
index b51cdc7..104521e 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -182,9 +182,8 @@ struct scoreboard {
 
 static int cmp_suspect(struct origin *a, struct origin *b)
 {
-	int cmp = hashcmp(a->commit->object.sha1, b->commit->object.sha1);
-	if (cmp)
-		return cmp;
+	if (a->commit != b->commit)
+		return 1;
 	return strcmp(a->path, b->path);
 }