git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] pretty: use fmt_output_email_subject()

From
René Scharfe <l.s.r@web.de>
Date
Mar 1, 2017, 15:41 UTC
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:
Show 10 quoted lines
> 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 <l.s.r@web.de>
> ---
> 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.
Show 22 quoted lines
> 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é
Previous: Jeff KingNext: René Scharfe
Message 12 of 13 in “format-patch subject-prefix gets truncated when using the --numbered flag”
  1. Adrian DudauFeb 28, 2017
  2. Junio C HamanoFeb 28, 2017
  3. Junio C HamanoFeb 28, 2017
  4. Jeff KingFeb 28, 2017
  5. Jeff KingFeb 28, 2017
  6. 2/2 pretty: use fmt_output_email_subject()René Scharfe, Mar 1, 2017
  7. Junio C HamanoMar 1, 2017
  8. Jeff KingMar 1, 2017
  9. Junio C HamanoMar 1, 2017
  10. Jeff KingMar 1, 2017
  11. Jeff KingMar 1, 2017
  12. René ScharfeMar 1, 2017
  13. 1/2 log-tree: factor out fmt_output_email_subject()René Scharfe, Mar 1, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.