> Yes, this seems like a severe abuse of the compiler. It makes much more > sense for this to be input as data rather than code.
Nonetheless, 4.7 seconds compilation time for one function seems a lot. Ok, it is 2000 lines long but pretty simple. What causes this? > On Wed, May 6, 2015 at 8:42 AM, Steven G. Johnson <[email protected]> > wrote: > >> It doesn't make sense to me to use code generation to spit out a literal >> expression for inputting a large sparse matrix on each iteration of >> optimization. In no conceivable compiler will this be faster than just >> using a loop to generate the sparse matrix data structure, rather than >> using a loop to generate the code to generate the sparse matrix and then >> compiling the generated code. It should be O(n) work in either case, but >> the constant factor will inevitably be worse for a compiler. >>
