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