[dub] Size of executable

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 27 06:14:49 PST 2014


On Thursday, 27 November 2014 at 13:59:23 UTC, CraigDillabaugh 
wrote:
> On Thursday, 27 November 2014 at 13:56:19 UTC, Chris wrote:
>> On Thursday, 27 November 2014 at 12:29:03 UTC, Gary Willoughby 
>> wrote:
>>> On Thursday, 27 November 2014 at 09:33:49 UTC, Chris wrote:
>>>> I usually use dub to create and build projects. I built one 
>>>> of the projects with dub and then by hand with dmd[1] 
>>>> passing all the files etc. Turned out that the executable 
>>>> built with dub was 1.4 MB whereas the one built by hand was 
>>>> only 807 kB. Why is that?
>>>
>>> dub compiles and links every file in the source folder 
>>> whether it's used or not. Whereas with dmd or rdmd you only 
>>> compile and link the files you actually use.
>>
>> I compiled the exact same files. I excluded those I didn't 
>> need in the dub configuration like so:
>>
>> "excludedSourceFiles": [...]
>>
>> But dub's executable is bigger.
>
> When you build with dub it should print out (if I remember 
> correctly, its been a little while) the command it uses to 
> build your code.  Is there any difference between that command 
> and your 'by hand' version?

dub says:

Compiling using dmd...
Linking...

I have the exact same setting, I think. I don't build for release 
with either method.

dmd file1.d file2.d file3.d ...

(dub compiles the same files, no release build)


More information about the Digitalmars-d-learn mailing list