digitalmars.D - File size of exe: DMD vs LDC
- Chris (3/3) May 09 2016 I have a program whose size is 3.2 MB when compiled with LDC, and
- Vladimir Panteleev (4/7) May 09 2016 You can upload the .map files to
- Jacob Carlborg (4/7) May 09 2016 LDC can strip sections which DMD cannot.
- Walter Bright (2/3) May 09 2016 Why not?
- Dicebot (6/9) May 09 2016 AFAIR, because of how ModuleInfo/TypeInfo is emitted which makes
- David Nadlinger (8/18) May 09 2016 It's something along those lines. What is certainly true is that
- Walter Bright (3/14) May 09 2016 Thanks. At least the deh sections are a non-issue now that DMD generates...
- Chris (6/9) May 12 2016 I've compiled the same code[1] with dmd v2.071.0 (release build)
- Nick Sabalausky (4/7) May 12 2016 FWIW, keep in mind that doesn't necessarily imply the same 2x scale will...
- David Nadlinger (5/8) May 12 2016 In typical programs, it is indeed a factor, and can be
- David Nadlinger (6/8) May 12 2016 To expand on that a bit, if you write template- and CTFE-less
I have a program whose size is 3.2 MB when compiled with LDC, and 6.3 MB when compiled with DMD. Both are release builds. That's almost twice as big.
May 09 2016
On Monday, 9 May 2016 at 10:58:12 UTC, Chris wrote:I have a program whose size is 3.2 MB when compiled with LDC, and 6.3 MB when compiled with DMD. Both are release builds. That's almost twice as big.You can upload the .map files to http://thecybershadow.net/d/mapview/ to get a visualization of what's taking how much space.
May 09 2016
On 2016-05-09 12:58, Chris wrote:I have a program whose size is 3.2 MB when compiled with LDC, and 6.3 MB when compiled with DMD. Both are release builds. That's almost twice as big.LDC can strip sections which DMD cannot. -- /Jacob Carlborg
May 09 2016
On 5/9/2016 5:24 AM, Jacob Carlborg wrote:LDC can strip sections which DMD cannot.Why not?
May 09 2016
On Monday, 9 May 2016 at 13:48:50 UTC, Walter Bright wrote:On 5/9/2016 5:24 AM, Jacob Carlborg wrote:AFAIR, because of how ModuleInfo/TypeInfo is emitted which makes linker never collect sections because they are referenced at least from there. LDC was intentionally modified to change code gen in that regard to make --gc-sections work - David will surely tell more :)LDC can strip sections which DMD cannot.Why not?
May 09 2016
On Monday, 9 May 2016 at 13:53:45 UTC, Dicebot wrote:On Monday, 9 May 2016 at 13:48:50 UTC, Walter Bright wrote:It's something along those lines. What is certainly true is that I spent quite some time trying to work around "interesting" linker behaviour to make this work. You can find more details on my solution at https://issues.dlang.org/show_bug.cgi?id=879. I haven't looked at DMD's related codegen in a while, so I don't know what exactly remains to be done there. — DavidOn 5/9/2016 5:24 AM, Jacob Carlborg wrote:AFAIR, because of how ModuleInfo/TypeInfo is emitted which makes linker never collect sections because they are referenced at least from there. LDC was intentionally modified to change code gen in that regard to make --gc-sections work - David will surely tell more :)LDC can strip sections which DMD cannot.Why not?
May 09 2016
On 5/9/2016 11:48 AM, David Nadlinger wrote:Thanks. At least the deh sections are a non-issue now that DMD generates Dwarf exception handling tables.AFAIR, because of how ModuleInfo/TypeInfo is emitted which makes linker never collect sections because they are referenced at least from there. LDC was intentionally modified to change code gen in that regard to make --gc-sections work - David will surely tell more :)It's something along those lines. What is certainly true is that I spent quite some time trying to work around "interesting" linker behaviour to make this work. You can find more details on my solution at https://issues.dlang.org/show_bug.cgi?id=879. I haven't looked at DMD's related codegen in a while, so I don't know what exactly remains to be done there. — David
May 09 2016
On Monday, 9 May 2016 at 20:06:55 UTC, Walter Bright wrote:On 5/9/2016 11:48 AM, David Nadlinger wrote: Thanks. At least the deh sections are a non-issue now that DMD generates Dwarf exception handling tables.I've compiled the same code[1] with dmd v2.071.0 (release build) and now the size has grown to 7.1 MB. It's 7.0 MB with dmd v2.070 (release build). [1] Same, except for the changes I had to make to adapt it to the new import system (`static import` etc.)
May 12 2016
On 05/09/2016 06:58 AM, Chris wrote:I have a program whose size is 3.2 MB when compiled with LDC, and 6.3 MB when compiled with DMD. Both are release builds. That's almost twice as big.FWIW, keep in mind that doesn't necessarily imply the same 2x scale will still hold for larger programs. Could be as much as 2x, could be as little as a constant +3MB.
May 12 2016
On Thursday, 12 May 2016 at 17:27:37 UTC, Nick Sabalausky wrote:FWIW, keep in mind that doesn't necessarily imply the same 2x scale will still hold for larger programs. Could be as much as 2x, could be as little as a constant +3MB.In typical programs, it is indeed a factor, and can be considerably more than 2x too. I've seen 400 MiB vs. 1.3 GiB, for example. — David
May 12 2016
On Thursday, 12 May 2016 at 21:35:12 UTC, David Nadlinger wrote:In typical programs it is indeed a factor, and can be considerably more than 2x too. […]To expand on that a bit, if you write template- and CTFE-less programs with no unused code and no inlined functions, you would obviously expect much less gain from linker-level dead code/data elimination than for a typical D2 program. — David
May 12 2016