The biggest compile time killer in my experience is actually running out of memory and hitting the swap.

My work app used to compile in about 8 seconds (on Linux btw). Then we added more and more stuff and it went up to about 20 seconds. It uses a fair amount of CTFE and template stuff, looping over almost every function in the program to generate code.

Annoying... but then we added a little bit more and it skyrocketed to about 90 seconds to compile! That's unbearable.

The cause was the build machine had run out of physical memory at the peak of the compile process, and started furiously swapping to disk.

I "fixed" it by convincing them to buy more RAM, and now we're back to ~15 second compiles, but at some point the compiler will have to address this. I know donc has a dmd fork where he's doing a lot of work, completely re-engineering CTFE, so it is coming, but that will probably be the next speed increase, and we could be looking at as much as 5x in cases like mine!


BTW apparently a dmd built with Microsoft's compile does the nasty in about 11 seconds rather than 30 for the std.algorithm build - comparable to the linux version with gcc. I really like dmc too, but a 3x speed increase is really significant for something that's relatively easy to do.

Reply via email to