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

Re: [PATCH] trace2: add dots directly to strbuf in perf_fmt_prepare()

From
Jeff King <peff@peff.net>
Date
Nov 4, 2019, 19:55 UTC
Message-ID
<20191104195508.GB20900@sigill.intra.peff.net>
In-Reply-To
<c4237b45-6faf-c1fc-eb13-b6c71b7fb6ef@web.de>
On Mon, Nov 04, 2019 at 08:27:54PM +0100, René Scharfe wrote:
> The initialization function of the Trace2 performance format target sets
> aside a stash of dots for indenting output.  Get rid of it and use
> strbuf_addchars() to provide dots on demand instead.  This shortens the
> code, gets rid of a small heap allocation and is a bit more efficient.

Yeah, the end result is much easier on the eyes. I am scratching my head at whether there is any advantage to copying the separate buffer, but I don't see one. The likelihood of having to allocate in the final "buf" strbuf is the same either way.

-Peff
Previous: René ScharfeNext: Jeff Hostetler
Message 2 of 3 in “trace2: add dots directly to strbuf in perf_fmt_prepare()”
  1. trace2: add dots directly to strbuf in perf_fmt_prepare()René Scharfe, Nov 4, 2019
  2. Jeff KingNov 4, 2019
  3. Jeff HostetlerNov 5, 2019

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.