No idea bout PyMC --- I don't even know if it's compiled
at some point or all interpreted in Python.
The Stan to C++ step should be fast, even with 10K lines of code.
The C++ compilation takes a long time because of the way the
C++ preprocessor expands templates. It generates efficient code,
but the preprocessor itself isn't so efficient and it can generate
a ton of code that itself takes forever to compile.
You are using clang++, right? And not running into memory
swapping issues?
The only way to solve this problem is to generate independent
translation units and link. Or to reduce the template dependency
depth. But for that, we need to know the instantiations. As is,
each of our densities with polymorphic vectorization and autodiff
yields on the order of 10^3 possible instantiations, with four-argument
ones being 10 times worse.
We honestly weren't anticipating people trying to compile
10K lines of Stan code. It'd be interesting at this point
to profile the C++ compiler and see where all the time's
going.
- Bob