Profiling the C++ compilation process

前端 未结 7 940
栀梦
栀梦 2020-11-28 19:48

I tend to write rather large templated header-only C++ libraries and my users commonly complain about compilation times. After thinking about the matter, it occurred to me t

7条回答
  •  醉梦人生
    2020-11-28 20:19

    There's a tool from the Boost project, which could be useful for pretty much any compiler and build system.

    The tool requires source code instrumentation with TEMPLATE_PROFILE_ENTER() and TEMPLATE_PROFILE_EXIT() macro calls. These macros then generate specific diagnostics (warnings) at compile-time, which are timed and collected along with instantiation callstacks (which consequently allow building and visualizing callgraphs) by a script. Not bad, IMO.

    I didn't use it yet though.

提交回复
热议问题