[PATCH 3/4] list-objects: optimize "revs->blob_objects = 0" case
- From
Jeff King <peff@peff.net>
- Date
- Jun 5, 2013, 22:40 UTC
- Message-ID
- <20130605224004.GC15607@sigill.intra.peff.net>
- In-Reply-To
- <20130605223551.GF8664@sigill.intra.peff.net>
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 <peff@peff.net> --- 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