Profiling the C++ compilation process

前端 未结 7 952
栀梦
栀梦 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:11

    Others have already suggested the -ftime-report command line flag for GCC, which makes the compiler print some statistics about the time consumed by each compilation phase. The drawback is that it only shows summary for one unit.

    I've written a Python script, which allows to print total summary on all units, by each compilation phase, given the project build log file. It also allows sorting by different phases. And it also allows to compare two log files (e.g., if you're trying to understand the impact of your changes).

提交回复
热议问题