[cfe-dev] [RFC] Identifying wasteful template function bodies

Ben Craig via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 4 08:51:34 PST 2019


Note that https://github.com/aras-p/ClangBuildAnalyzer already has some information that helps in these kinds of diagnosing.  It consumes the traces from -ftime-trace.  It has good ways of saying which template instantiations took too long over your code base, and hacky ways of saying which templates took too long to instantiate (I wrote the hacky thing).  Here's a more recent view into the output that you can get: https://github.com/aras-p/ClangBuildAnalyzer/blob/master/tests/self-win-clang-cl-9.0rc2/_AnalysisOutputExpected.txt

I will say that one gap in this profiling tool is large quantities of tiny functions / templates, e.g. std::move.  -ftime-trace won't trace events that are sufficiently small, so it can miss things like std::move that involve a huge quantity of tiny instantiations.

> -----Original Message-----
> From: cfe-dev <cfe-dev-bounces at lists.llvm.org> On Behalf Of Brian Gesiak
> via cfe-dev
> Sent: Wednesday, December 4, 2019 10:04 AM
> To: David Blaikie <dblaikie at gmail.com>
> Cc: cfe-dev <cfe-dev at lists.llvm.org>
> Subject: [EXTERNAL] Re: [cfe-dev] [RFC] Identifying wasteful template
> function bodies
> 
> Awesome, thanks all!
> 
> > On Mon, Dec 2, 2019 at 2:42 PM Reid Kleckner via cfe-dev <cfe-
> dev at lists.llvm.org> wrote:
> >> I like this idea. I'm not sure a warning is the best way to surface it. The first
> alternative that occurs to be would be the -ftime-trace JSON file, so you can
> dump out complete info about the most often instantiated templates, how
> many nodes they contained, and how many of them were dependent.
> 
> This is a great idea. I'll try to get this working and send a patch.
> 
> The discussion on ADL was interesting as well. I'm glad I asked the list,
> thanks!
> 
> - Brian
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://urldefense.com/v3/__https://lists.llvm.org/cgi-
> bin/mailman/listinfo/cfe-dev__;!!FbZ0ZwI3Qg!-
> pVFNcaaFVYdPdIuBJkdNWBPr_-Z-PjM8KlbAi71-2e56yNnxYZYarYnQ6WN$


More information about the cfe-dev mailing list