Template instantations are killing me softly today (part 3)

goto part2

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>>;

without_externing
without externing LU
LU_externed
LU decomposition externed

huzzah, the number of calls went down for the BMP numbers.

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 externs...

Conclusions

I am still perpelexed. Externing has had these negative side-effects:

  1. Has led to longer compile times, bafflingly enough. This is at -O2 in Clang coming with XCode 8.
  2. 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.
  3. Is definitely not compilable with the integer-based backends for Boost.Multiprecision, gmp_integer and gmp_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.

trying out unity build in bertini2's core library