On Saturday 26 September 2015 01:24, Atila Neves wrote:
> There have been threads about this before. It turns out that
> compiling per file is usually slower than compiling the whole
> package/app at once. It's not intuitive, but it's true (I
> measured it myself). reggae has an option to compile per-file but
> I haven't used it since switching to per-package once.
Compiling one file at a time is yet another thing.
1) Compile everything into one object file:
dmd -c -ofresult.o foo.d bar.d
2) Compile to multiple object files in one run:
dmd -c foo.d bar.d
3) Compile to multiple object files in multiple runs:
dmd -c foo.d; dmd -c bar.d
Since you didn't know about 2, I take it that you measured 1 vs 3. 3 is
bound to be slower when the modules share dependencies, because they have to
be parsed again and again.
2 may be faster or slower than 1, I don't know, a quick check didn't show a
difference. When the template instantiation issue ever gets fixed, I
wouldn't be surprised if 2 got slower than 1. Of course, any slowness of 2
must then be weighed against 1 compiling more than necessary.