Clang: How to Analyse Compiletime of Templates?

hello clang-devs,

is clang able to help me to finde the most compiletime consuming
templates in a 500KLOC app
which uses a huge template library - something like a overview what
templates are reasonable to optimize
(in my case hide the template behind a specialized interface)

i've read about /ftime

https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/

but that seems no to help with template instanciation

any advice?

Hi Dennis,

Along with -ftime-trace, try either:
- Clang Build Analyzer: Clang Build Analyzer ยท Aras' website
- See++ Compiler Profiler: GitHub - Viladoman/SeeProfiler: Clang C/C++ Visual Profiler for compile times visualization

-----Message d'origine-----

Thx for the links, very promising

You can also take a look at templight: https://github.com/mikael-s-persson/templight

i get this assertion (using latest Windows
Build(https://llvm.org/builds/) installer + VStudio extension)

1>Assertion failed: TimeTraceProfilerInstance == nullptr && "Profiler
should not be initialized", file
C:\src\llvm_package_2663a25f\llvm-project\llvm\lib\Support\TimeProfiler.cpp,
line 253
1>Stack dump:

assert in Function: void timeTraceProfilerInitialize(unsigned
TimeTraceGranularity)

-ftime-trace Option gives this error on both Project properties

VStudio Project properties
Configuration Properties -> C/C++ -> Command Line
Configuration Properties -> LLVM -> Additional Compiler Options

the very same LLVM/clang-cl installation works with -ftime-trace on a
much bigger project of my colleague