How to stop DMD from exploding the executable file size?

H. S. Teoh hsteoh at qfbox.info
Tue Aug 30 23:05:16 UTC 2022


On Tue, Aug 30, 2022 at 10:51:46PM +0000, ryuukk_ via Digitalmars-d wrote:
> Having this simple code makes the executable gigantic!
> 
> ```D
> struct Big
> {
>     int[1024 * 1024] big = 0;
> }
> 
> Big big;
> ```
> 
> Only with DMD, LDC produces a tiny executable
> 
> Is there a flag available to fix this behavior? it's not sustainable

Which version of dmd are you using? I tried to compile the above code
with 2.098 (old git master) and the total executable size is only 900KB.

I remember about a year or two ago there was a bug where dmd would
generate 1024 * 1024 store instructions to initialize the array, but I
just checked the disassembly, it's now a rep stos, which is very small.


T

-- 
Life is unfair. Ask too much from it, and it may decide you don't deserve what you have now either.


More information about the Digitalmars-d mailing list