Profiling template metaprogram compilation time

前端 未结 4 569
面向向阳花
面向向阳花 2020-12-14 17:11

I\'m working on a C++ project with extensive compile-time computations. Long compilation time is slowing us down. How might I find out the slowest parts of our template me

4条回答
  •  不思量自难忘°
    2020-12-14 17:51

    The classic book C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond comes with a 20 page appendix on profiling compile-time costs. It has a companion CD with the code that generates the graphs in that appendix.

    Another paper is http://aszt.inf.elte.hu/~gsd/s/cikkek/profiling/profile.pdf, perhaps that is of use to you.

    Yet another, but more labor-intensive, way is to count the number of instantiations of each class from your compiler output.

提交回复
热议问题