Why exe size change if import entire std or just writeln?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Mar 24 02:30:35 UTC 2022


On Thu, Mar 24, 2022 at 01:49:30AM +0000, Marcone via Digitalmars-d-learn wrote:
> import std.stdio : writeln;
> 
> void main(){
> 	writeln("Bom dia");
> }
> 
> 
> Size exe file: 258 KB
> 
> --------------------------------------------------------------
> 
> import std;
> 
> void main(){
> 	writeln("Bom dia");
> }
> 
> Size exe file: 595 KB
> 
> 
> 
> If dependencies are resolved at compile time, why does the compiler
> include extra stuff?

Did you compile with LTO?  If not, the exe may carry extra baggage,
since the linker may not have tried to shed excess baggage.


T

-- 
My father told me I wasn't at all afraid of hard work. I could lie down right next to it and go to sleep. -- Walter Bright


More information about the Digitalmars-d-learn mailing list