www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Again, ask help with Dlang program footprint

reply dangbinghoo <dangbinghoo gmail.com> writes:
hi,

I just asked for help about this before, on that time, my 
solution is to remove whatever dub dependencies which are 
optional.

now, I'm re-examining the dlang program footprint size, and I put 
a github example repo here:

https://github.com/dangbinghoo/dlang_footprint_test.git

the example is simply a json ser/deser test depends on ASDF, on 
my machine it generates a binary about 914K using LDC2.

Note: as I'm focused on embedded system development, what I want 
help with is only for the situation using LDC compiler.

thanks!
Apr 07 2022
parent reply dangbinghoo <dangbinghoo gmail.com> writes:
On Friday, 8 April 2022 at 03:20:29 UTC, dangbinghoo wrote:
 hi,

 I just asked for help about this before, on that time, my 
 solution is to remove whatever dub dependencies which are 
 optional.

 now, I'm re-examining the dlang program footprint size, and I 
 put a github example repo here:

 https://github.com/dangbinghoo/dlang_footprint_test.git

 the example is simply a json ser/deser test depends on ASDF, on 
 my machine it generates a binary about 914K using LDC2.

 Note: as I'm focused on embedded system development, what I 
 want help with is only for the situation using LDC compiler.

 thanks!
PS: I need the program link Phobos statically, don't want to use .so except the basic C library. so I added option `-link-defaultlib-shared=false` in dub.json by default, this should not be changed.
Apr 07 2022
parent reply dangbinghoo <dangbinghoo gmail.com> writes:
On Friday, 8 April 2022 at 03:26:29 UTC, dangbinghoo wrote:
 On Friday, 8 April 2022 at 03:20:29 UTC, dangbinghoo wrote:
 [...]
PS: I need the program link Phobos statically, don't want to use .so except the basic C library. so I added option `-link-defaultlib-shared=false` in dub.json by default, this should not be changed.
hi, please help with this, can we reduce the footprint? thanks!
Apr 08 2022
parent reply dangbinghoo <dangbinghoo gmail.com> writes:
On Saturday, 9 April 2022 at 02:19:52 UTC, dangbinghoo wrote:
 On Friday, 8 April 2022 at 03:26:29 UTC, dangbinghoo wrote:
 On Friday, 8 April 2022 at 03:20:29 UTC, dangbinghoo wrote:
 [...]
PS: I need the program link Phobos statically, don't want to use .so except the basic C library. so I added option `-link-defaultlib-shared=false` in dub.json by default, this should not be changed.
hi, please help with this, can we reduce the footprint? thanks!
OK, I just put on another git repo, which is the simpley helloworld in D, and it generates 849KB for print a single line! https://github.com/dangbinghoo/hello_world_d so, maybe there's something wrong with D compiling? thanks!
Apr 08 2022
parent dangbinghoo <dangbinghoo gmail.com> writes:
On Saturday, 9 April 2022 at 02:56:50 UTC, dangbinghoo wrote:
 On Saturday, 9 April 2022 at 02:19:52 UTC, dangbinghoo wrote:
 On Friday, 8 April 2022 at 03:26:29 UTC, dangbinghoo wrote:
 On Friday, 8 April 2022 at 03:20:29 UTC, dangbinghoo wrote:
 [...]
PS: I need the program link Phobos statically, don't want to use .so except the basic C library. so I added option `-link-defaultlib-shared=false` in dub.json by default, this should not be changed.
hi, please help with this, can we reduce the footprint? thanks!
OK, I just put on another git repo, which is the simpley helloworld in D, and it generates 849KB for print a single line! https://github.com/dangbinghoo/hello_world_d so, maybe there's something wrong with D compiling? thanks!
OK, talked in Discord. answer is clear: 1. D runtime is about 400KB on amd64 stripped. 2. phobos is set of big templates, writeln is expensive. betterC print a helloworld only costs 6.3KB stripped. thanks!
Apr 08 2022