I happily use Boost.Multiprecision inside a largely templated codebase, which involves the entirely-templated Eigen as well. My compile times are high.
To gain insight into why compile time is so ridiculous, I used Templight
with Clang to query how many times my templates are instantiated, and how long they take. The answer was overwhelmingly that Boost.Multiprecision's number
class is to blame, with 8264 instantiations of
5052 of the same with the gmp_int backend, and 2689 for mpz_rational.
I think the cure might be an extern template declaration on these three types, but where is the correct place to do this? In a header I have written which provides a few extensions / additions I needed? Or do I need to patch my install of BMP and put it there?
As a follow-up, I have a cycle of instantiations I believe, but do not yet know, are expression templates. Can I extern a few common instantiations, and let the compiler do the rest? Any help or techniques are greatly appreciated. Especially as I (slowly) move toward applying expression templates to complex multiprecision arithmetic, too.
Thanks a ton,
University of Notre Dame
Applied and Computational Mathematics and Statistics