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

Re: [PATCH] Reduce performance penalty for turned off traces

From
Jeff King <peff@peff.net>
Date
Nov 17, 2017, 22:12 UTC
Message-ID
<20171117221251.sku6lqbemcddvlky@sigill.intra.peff.net>
In-Reply-To
<CAPu-DQr0eRYiafF64=Mwm56xJgNPH0HVm+B4vKnzK0iAE4_xUg@mail.gmail.com>
On Sun, Nov 12, 2017 at 11:24:11PM +0000, Gennady Kupava wrote:
Show 6 quoted lines
> In reality, gcc didn't do that and I saw 3 function calls. I am pretty
> sure that compiler of the distant bright future will do that, and only
> problem would be to eliminate that single function call. Hopefully
> with -flto it will also eliminate this single functions call, at it
> will be able to see through translation units. Given that I actually
> like current implementation as it hides all details in .c file.

Yeah, I agree with your analysis that we are really just overriding what could eventually be figured out by the compiler during LTO.

I do think this is worth pursuing in the meantime, though, because it's not _too_ much work, and we don't know when that magical optimizing compiler will appear. :) So this frees us up in the meantime to worry less about the cost of tracing.

Show 5 quoted lines
> Now, implementation you suggesting moves extra things into .h, so it
> is imperfect in terms above, while things I suggested moves only
> necessary bit of checking the necessity to do anything, which is only
> (interesting) part should be executed while traces are off, and the
> only part we really want to be inlined.

I only meant to suggest moving the necessary checking into the .h file. It's just that we have to make it a static inline for cases where we don't have variadic macros. Anyway, I'm OK with your original notion of leaving the non-variadic-macro systems on the "slow" path, so we can just go with the pure-macro thing you have.

Show 10 quoted lines
> > So it is measurable, and we might expect that tracing a really big loop
> > (say over all of the objects in the repository) would benefit. OTOH, a
> > real loop would actually be doing other stuff, so the speedup would be
> > less dramatic. Still, it seems like an easy win.
> 
> I actually quite familiar with performance analysis and know how to
> use perf and similar tools a bit -
> so if there is something more measurable in TODO, I could try. But I
> guess this is interesting to many devs so such tasks probably already
> all done and bottlenecks are identified in git =)

There are lots of bottlenecks still to be found, I'm sure. If you want to have a go at finding some with perf, be my guest. :)

-Peff
Previous: Gennady KupavaNext: Stefan Beller
Message 4 of 20 in “Reduce performance penalty for turned off traces”
  1. Reduce performance penalty for turned off tracesgennady.kupava@gmail.com, Nov 11, 2017
  2. Jeff KingNov 12, 2017
  3. Gennady KupavaNov 12, 2017
  4. Jeff KingNov 17, 2017
  5. Stefan BellerNov 15, 2017
  6. Jeff KingNov 17, 2017
  7. 1/2 Simplify tracing code by removing trace key normalization conceptgennady.kupava@gmail.com, Nov 19, 2017
  8. 2/2 Reduce performance cost of the trace if trace category is disabledgennady.kupava@gmail.com, Nov 19, 2017
  9. Johannes SixtNov 19, 2017
  10. Gennady KupavaNov 19, 2017
  11. Junio C HamanoNov 19, 2017
  12. Gennady KupavaNov 19, 2017
  13. Junio C HamanoNov 20, 2017
  14. Junio C HamanoNov 20, 2017
  15. 1/2 trace: remove trace key normalizationgennady.kupava@gmail.com, Nov 26, 2017
  16. 2/2 trace: improve performance while category is disabledgennady.kupava@gmail.com, Nov 26, 2017
  17. Junio C HamanoNov 27, 2017
  18. Junio C HamanoNov 27, 2017
  19. Junio C HamanoNov 27, 2017
  20. Gennady KupavaNov 27, 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.