Template instantations are killing me softly today (part 3)
May 5, 2017
I'm going to keep at this extern template
thing until I understand it. I will.
I was able to get the number of calls to the number
types from Boost.Multiprecision down, by explicitly instantiating
extern template class Eigen::PartialPivLU<bertini::Mat<bertini::dbl>>;
extern template class Eigen::PartialPivLU<bertini::Mat<bertini::mpfr>>;
huzzah, the number of calls went down for the BMP number
s.
I note that an author of Eigen was asking similar questions in 2008 here at this GCC forum post
So, I timed the build using XCode's clang, in -O2
, and it was SLOWER for the endgame tests. SLOWER. What is going on? I went from 1m6s to 1m34s. I am doing something seriously wrong here with my extern
s...
Conclusions
I am still perpelexed. Extern
ing has had these negative side-effects:
- Has led to longer compile times, bafflingly enough. This is at
-O2
in Clang coming with XCode 8. - Is not even compilable without removing static asserts for the
mpfr_float
backend in Boost.Multiprecision, and two in Eigen. So a non-solution, really. - Is definitely not compilable with the integer-based backends for Boost.Multiprecision,
gmp_integer
andgmp_rational
. How unfortunate.
Next steps:
- try out a Unity Build. I have found some good resources, and people say their build times go down dramatically. Also, you don't HAVE to Unity-build if you set up CMake the right way. Here's an example CMake bit of code for doing the Unity thing.
- Consider the downsides. Here is someone's negative opinion regarding them. Hey' that's why we have options, right?
So, I will try it out.