Thread overview
Can DUB --combined builds be faster?
Mar 14, 2016
Guillaume Piolat
Mar 14, 2016
Rene Zwanenburg
Mar 14, 2016
Guillaume Piolat
Mar 15, 2016
thedeemon
Mar 15, 2016
Chris Wright
March 14, 2016
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?
March 14, 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.
March 14, 2016
On Monday, 14 March 2016 at 11:50:38 UTC, Rene Zwanenburg wrote:
>
> 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.

Thanks for the test!
March 15, 2016
On Monday, 14 March 2016 at 11:50:38 UTC, Rene Zwanenburg wrote:

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

How does it work? Is it because the source of foo() is visible to the compiler when producing the result?
March 15, 2016
On Tue, 15 Mar 2016 01:54:51 +0000, thedeemon wrote:

> On Monday, 14 March 2016 at 11:50:38 UTC, Rene Zwanenburg wrote:
> 
>> When building in release mode the call to foo() gets inlined just fine
>> without --combined.
> 
> How does it work? Is it because the source of foo() is visible to the compiler when producing the result?

Yes.