D is supposed to compile fast.

Adam D. Ruppe destructionator at gmail.com
Fri Nov 23 17:37:46 UTC 2018


On Friday, 23 November 2018 at 17:21:46 UTC, H. S. Teoh wrote:
> Are you using template-heavy Phobos functions?

Merely importing a Phobos module is liable to cost you a quarter 
second or more of compile time.

I just got my gui lib (22,000 lines of raw source, dscanner -sloc 
reports 12,000) compiling in 0.2s on Linux, down from 1.0s, by 
removing ALL the phobos imports. It is 0.6s on Windows, probably 
because it imports so many of the Windows headers.


I like to say C style and Java style code compiles really fast... 
but you wanna beware of imports of the standard library, since it 
brings in a LOT of code, some of which is really slow to run 
(parts of it are slower than others, like std.algorithm is 
actually pretty fast to compile+use, but std.regex is brutally 
slow)


More information about the Digitalmars-d-learn mailing list