Thread (20 messages) flat view 20 messages, 7 authors, 2016-06-15
DORMANTno replies

[PATCH 3/4] list-objects: optimize "revs->blob_objects = 0" case

From: Jeff King <hidden>
Date: 2016-06-15 22:57:34
Subsystem: the rest · Maintainer: Linus Torvalds

If we are traversing trees during a "--objects"
traversal, we may skip blobs if the "blob_objects" field of
rev_info is not set. But we do so as the first thing in
process_blob(), only after we have actually created the
"struct blob" object, incurring a hash lookup. We can
optimize out this no-op call completely.

This does not actually affect any current code, as all of
the current traversals always set blob_objects when looking
at objects, anyway.

Signed-off-by: Jeff King <redacted>
---
 list-objects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/list-objects.c b/list-objects.c
index c8c3463..77e6ec5 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -116,7 +116,7 @@ static void process_tree(struct rev_info *revs,
 			process_gitlink(revs, entry.sha1,
 					show, &me, entry.path,
 					cb_data);
-		else
+		else if (revs->blob_objects)
 			process_blob(revs,
 				     lookup_blob(entry.sha1),
 				     show, &me, entry.path,
-- 
1.8.3.rc2.14.g7eee6b3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help