digitalmars.D.learn - Can DUB --combined builds be faster?
- Guillaume Piolat (8/8) Mar 14 2016 I'm cargo-culting the use of --combined with DUB because I
- Rene Zwanenburg (12/20) Mar 14 2016 It shouldn't make a difference for the resulting executable, but
- Guillaume Piolat (2/13) Mar 14 2016 Thanks for the test!
- thedeemon (3/5) Mar 14 2016 How does it work? Is it because the source of foo() is visible to
- Chris Wright (2/9) Mar 14 2016 Yes.
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?
Mar 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.
Mar 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!
Mar 14 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?
Mar 14 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:Yes.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?
Mar 14 2016