Many command have code similar to the following: while ((commit = get_revision(rev)) != NULL) { ... } This results in and extra call to get_revision that first finds the next revision and then notices max-count is 0 and returns NULL. Adding a max-count check before any expensive work reduces the runtime of all of the commands the have this pattern. Depending on the use case this can have a big impact on the running time. Signed-off-by: Benjamin C Meyer <bmeyer@xxxxxxx> --- revision.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/revision.c b/revision.c index 490b484..4673d70 100644 --- a/revision.c +++ b/revision.c @@ -2058,6 +2058,9 @@ static struct commit *get_revision_internal(struct rev_info *revs) struct commit *get_revision(struct rev_info *revs) { + if (revs->max_count == 0) + return NULL; + struct commit *c; struct commit_list *reversed; -- 1.7.0.2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html