From: René Scharfe Date: Wed, 01 Mar 2017 15:41:36 GMT Subject: Re: [PATCH 2/2] pretty: use fmt_output_email_subject() Message-ID: <373c7cca-3fd8-bf25-f45b-16249f160ee5@web.de> In-Reply-To: <58e05599-5dc4-9881-d8c0-89ad1f2e3838@web.de> Am 01.03.2017 um 12:37 schrieb René Scharfe: > Add the email-style subject prefix (e.g. "Subject: [PATCH] ") directly > when it's needed instead of letting log_write_email_headers() prepare > it in a static buffer in advance. This simplifies storage ownership and > code flow. > > Signed-off-by: Rene Scharfe > --- > This slows down the last three tests in p4000 by ca. 3% for some reason, > so we may want to only do the first part for now, which is performance > neutral on my machine. Update below. > diff --git a/commit.h b/commit.h > index 9c12abb911..459daef94a 100644 > --- a/commit.h > +++ b/commit.h > @@ -142,21 +142,24 @@ static inline int cmit_fmt_is_mail(enum cmit_fmt fmt) > return (fmt == CMIT_FMT_EMAIL || fmt == CMIT_FMT_MBOXRD); > } > > +struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */ > + > struct pretty_print_context { > /* > * Callers should tweak these to change the behavior of pp_* functions. > */ > enum cmit_fmt fmt; > int abbrev; > - const char *subject; > const char *after_subject; > int preserve_subject; > struct date_mode date_mode; > unsigned date_mode_explicit:1; > + unsigned print_email_subject:1; Turning this into an int restores performance according to p4000. Didn't know that bitfields can be *that* expensive. René