compiler-explorer icon indicating copy to clipboard operation
compiler-explorer copied to clipboard

Feature Request: Compiler Performance Explorer!

Open vinniefalco opened this issue 6 years ago • 4 comments

Compiler Explorer is wonderful for showing the run-time impact of the compiler on code. But how about the compile-time impact of the code on the compiler? It would be nice to have an option (probably only for clang) to show the memory consumption of the compiler, and also integrate "templight" which is a tool that reports on the compiler's instantiations of templates. You can read about it here:

https://github.com/mikael-s-persson/templight

This tool is very helpful for reducing the memory usage and compile time of templates, especially when an implementation uses a lot of metaprogramming.

vinniefalco avatar Nov 21 '18 17:11 vinniefalco

Hello, I'm kind of reviving this issue as I really think it would be awesome if we could have some compile time profiling in compiler explorer !

Recently clang added (only available in the trunk right now) the -ftime-trace command that outputs the compile time profile in the chrome trace format. See https://reviews.llvm.org/rL357340.

This seems to already be working on CE https://godbolt.org/z/BTGtlQ so I suppose now the only thing that would be left would be to let us download the file or install a local version of Speedscope ? I'm not sure about the size of the generated traces though, that could become an issue.

Lectem avatar Jul 07 '19 09:07 Lectem

I am quite often frustrated by the heavy templated code which is showed off in compiler exploerer which I cannot really use without completely blowing my compile times out of the window.

Using -ftime-trace would be a really useful tool to show the compile time impact of the proposed code, the more constexpr the language goes, the more compile time will play a significant role.

To make that usable it would be necessary to integrate the flamegrah (e.g. the one from the speedscope app) into a own panel. When then compiling with -ftime-trace the flamegraph of your compilation would be shown there by rendering the resulting json file.

I have no clue how complicating this would be to set up, but I'm willing to help.

pizzard avatar May 01 '20 11:05 pizzard

One more complex thing one could do with the speedscope integration is also add profiling of the execution of the program, by feeding perf -> stackcollapse -> speedscope.

pizzard avatar May 01 '20 11:05 pizzard

I've been doing a bunch of work using Google's trace format in my day job, so I ought to be able to get the -ftime-trace json information pinged to perfetto.dev at least to visualise. And then look at the flame graph stuff too.

mattgodbolt avatar Jul 06 '22 02:07 mattgodbolt

If you add -ftime-trace to a Clang compiler you'll now get the option to take a look at that. This isn't entirely what was asked here, but for an issue from 2018, it's better than nothing. We can iterate from here to add more stuff, I would think.

partouf avatar Apr 23 '23 11:04 partouf