2

After adding some template-template parameters, I found the compilation of my c++ unit-tests are kind of slow.

The templates helped me to avoid code duplication in testing const/non-const methods/objects.

Is it possible to benchmark each template's compilation time?

I am using gcc now, but the code also works for clang++ and intel c++ compiler.

R zu
  • 2,034
  • 12
  • 30
  • Sure - I'll even throw in how! Print the time before you start compilation; print the time after; subtract. If you wanted something more specific though I think you'll have to ask a more specific question – UKMonkey Apr 27 '18 at 15:13
  • But that doesn't tell which template makes the compilation slow. There are like 10 templates (template functions and template classes) in the unit test (`test_span.cpp`) for one template class ... Unless I put just one template per header. That is kind of tedious and painful. – R zu Apr 27 '18 at 15:14

0 Answers0