Programs in D are huge

user1234 user1234 at 12.de
Tue Aug 16 08:36:41 UTC 2022


On Tuesday, 16 August 2022 at 08:25:18 UTC, Diego wrote:
> Hello everyone,
>
> I'm a Java programmer at work but i'm learning D for pleasure. 
> I'm reading _The D Programming Language by Ali Çehreli_.
>
> I noticed that DMD creates very huge executable, for example an 
> empty program:
>
> ```
> empty.d:
>
> void main() {
> 	
> }
> ```
>
> after a compilation with these flags `dmd -de -w empty.d` i 
> have an executable of 869KiB
> It seams huge in my opinion for an empty program
>
> What are the best practices to reduce the size?

This is normal, by default you have plenty of typeinfo (static 
data allowing dynamic introspection), code located in implicit 
import object.d, the runtime (e.g code for the GC).

You can really get rid of that, excepted using -betterC, but you 
see all the stuff that make the default main program big will 
actually be useful in a real program.

It's just that D is not as much "pay as you go" as that, for now.



More information about the Digitalmars-d-learn mailing list