Can DUB --combined builds be faster?

Rene Zwanenburg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 14 04:50:38 PDT 2016


On Monday, 14 March 2016 at 11:03:41 UTC, Guillaume Piolat wrote:
> I'm cargo-culting the use of --combined with DUB because I 
> somehow think inlining will be better in this way. (For thos 
> who don't use DUB, what it does is compiling the whole program 
> with a single compiler invokation instead of making one static 
> library by package.)
>
> But I've never measured much speed-up that way so I wonder if 
> it's a dumb thing to do.
>
> Is there a theoretical reason --combined builds may be faster?

It shouldn't make a difference for the resulting executable, but 
compilation itself may be faster. I did a little test just to be 
sure. Two DUB packages, one with:

module m;
string foo() { return "asdf"; }

And the other:
import m;
import std.stdio;
void main() { writeln(foo()); }

When building in release mode the call to foo() gets inlined just 
fine without --combined.


More information about the Digitalmars-d-learn mailing list