The D ecosystem in Debian with free-as-in-freedom DMD

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Tue May 2 18:02:38 PDT 2017


On Tuesday, 2 May 2017 at 23:27:28 UTC, Marco Leise wrote:
> Am Tue, 02 May 2017 20:53:50 +0000
> schrieb Moritz Maxeiner <moritz at ucworks.org>:
>
>> On Tuesday, 2 May 2017 at 19:34:44 UTC, Marco Leise wrote:
>> >
>> > I see what you're doing there, but your last point is 
>> > wishful thinking. Dynamically linked binaries can share 
>> > megabytes of code. Even Phobos - although heavily templated 
>> > - has proven to be very amenable to sharing. For example, a 
>> > "Hello world!" program using `writeln()` has these sizes 
>> > when compiled with `dmd -O -release -inline`:
>> >
>> >      static Phobos2 : 806968 bytes
>> >     dynamic Phobos2 :  18552 bytes
>> >
>> > That's about 770 KiB to share or 97.7% of its total size! 
>> > Awesome!
>> 
>> Is all of that active code, or is some of that (statically 
>> knowable) never getting executed (as in could've been removed 
>> at compile/link time)?
>
> I guess David gave you the answer. So it's just 95.4% of its
> total size. :p

Under the assumption that ldc2 produces no dead code in the 
output; is that a reasonable assumption (I'm not sure)?

> By the way, is the fully dynamic linking version possible with
> ldc2 now as well ?

I did have a modified ebuild to try that out a while back and it 
seemed to work fine in my limited testing scope. Since I quite 
often change installed d compilers and don't want my programs 
(like tilix) to stop working (or have old d compiler versions 
being kept installed *just* because some programs were built with 
them), I generally link against phobos statically, anyway, so I 
my tests weren't exhaustive. The cmake flag to to use in the 
ebuild would be BUILD_SHARED [1].

[1] 
https://github.com/ldc-developers/ldc/blob/v1.2.0/CMakeLists.txt#L522


More information about the Digitalmars-d mailing list