Print message size just before the corresponding message to speedup the parsing by scripts/porcelains tools. Because git log output is normally read incrementally by porcelain tools, if message size is ignored then an expensive seek of the delimiting char, as example '\0' must be done when parsing the output stream. With this patch it is possible to avoid an otherwise mandatory seek for '\0' starting from the beginning of log body. Signed-off-by: Marco Costalba <mcostalba@xxxxxxxxx> --- This little patch makes great difference in loading performance of our loved ;-) tool....and probably also others. Please apply. Thanks Marco log-tree.c | 3 +++ revision.c | 4 ++++ revision.h | 1 + 3 files changed, 8 insertions(+), 0 deletions(-) diff --git a/log-tree.c b/log-tree.c index 8624d5a..2fb7761 100644 --- a/log-tree.c +++ b/log-tree.c @@ -295,6 +295,9 @@ void show_log(struct rev_info *opt, if (opt->add_signoff) len = append_signoff(&msgbuf, &msgbuf_len, len, opt->add_signoff); + if (opt->show_size) + printf("size %i\n", len); + printf("%s%s%s", msgbuf, extra, sep); free(msgbuf); } diff --git a/revision.c b/revision.c index 33ee9ee..3850a1e 100644 --- a/revision.c +++ b/revision.c @@ -1136,6 +1136,10 @@ int setup_revisions(int argc, continue; } + if (!strcmp(arg, "--show-size")) { + revs->show_size = 1; + continue; + } /* * Grepping the commit log diff --git a/revision.h b/revision.h index f46b4d5..584b3f1 100644 --- a/revision.h +++ b/revision.h @@ -81,6 +81,7 @@ struct rev_info { const char *log_reencode; const char *subject_prefix; int no_inline; + int show_size; /* Filter by commit log message */ struct grep_opt *grep_filter; -- 1.5.3.rc0.81.g1ed84-dirty - 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