Skip to content

ranges in phobos increase exe size#4754

Merged
MartinNowak merged 1 commit intodlang:masterfrom
WalterBright:increasesize
Jun 20, 2015
Merged

ranges in phobos increase exe size#4754
MartinNowak merged 1 commit intodlang:masterfrom
WalterBright:increasesize

Conversation

@WalterBright
Copy link
Member

not much to be done about that.

@MartinNowak
Copy link
Member

:-(

not much to be done about that.

Well you don't use datetime at all, so we need to find out how to keep that dead code out of the binary.

MartinNowak added a commit that referenced this pull request Jun 20, 2015
ranges in phobos increase exe size
@MartinNowak MartinNowak merged commit 3cdb5df into dlang:master Jun 20, 2015
@WalterBright
Copy link
Member Author

It may have been an accumulation of things that this change just put past the trigger.

@WalterBright WalterBright deleted the increasesize branch June 20, 2015 17:01
@dnadlinger
Copy link
Contributor

--gc-sections seems to be quite an effective way to work around the codegen issues. I can't easily check with the 2.068 Phobos on LDC right now, but on 2.067 the Linux x86_64 executable for that test is only 30% the size of DMD's.

@MartinNowak
Copy link
Member

We had little to no effect of gc-sections with dmd, mostly because it already uses multilibs.
I think the root problem is that the ModuleInfo hard-links imported modules and all classes within a module. The classes vtable the drags all the member functions and lots of other stuff.
I spent some time to make weak external references work, but there were concerns to use that b/c it might break Object.factory.
#4638

@dnadlinger
Copy link
Contributor

Well, all I'm saying is that LDC's executable is much smaller, and --gc-sections certainly contributes to that.

@WalterBright
Copy link
Member Author

Object.factory in hindsight was a mistake. It should only work with classes marked with export. It's probably worthwhile to fix that.

@MartinNowak
Copy link
Member

Might make an interesting story for the next release, though export still needs a lot of fixes. Also there are more important topics than binary size.

@mihails-strasuns-sociomantic
Copy link
Contributor

on 2.067 the Linux x86_64 executable for that test is only 30% the size of DMD's

Still about the same ratio for 2.068 (with both linked to shared phobos library)

-rwxr-xr-x 1 mihails mihails 139K Aug 20 18:34 hello-dmd
-rwxr-xr-x 1 mihails mihails  47K Aug 20 18:33 hello-ldc

(for a simple app that uses some template utilities)

void main ()
{
    import std.stdio, std.algorithm;
    writeln([ 1, 2, 3 ].map!(a => 2*a));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants