Re: Clean Executable

2017-06-27 Thread bauss via Digitalmars-d-learn

On Tuesday, 27 June 2017 at 14:21:50 UTC, FoxyBrown wrote:
How can we clean an exe from the junk library functions that 
are not actually used by an app. e.g., a hello world program 
shouldn't be 500+kb. I release there are necessary extras like 
the GC, but hell, in a hello world program is it even 
necessary? Does Writeln even use the GC to display a single 
string?


Seems like D just does not optimize the binaries size. I know 
it's only 500kb, but still.


If you want optimizations don't use DMD.


Re: Clean Executable

2017-06-27 Thread Adam D. Ruppe via Digitalmars-d-learn

On Tuesday, 27 June 2017 at 14:21:50 UTC, FoxyBrown wrote:

Does Writeln even use the GC to display a single string?


Not if all goes well, but a good chunk of the library is loaded 
to handle various situations. It might call a GC function if 
there's no stdout.


Take a look at this:

http://thecybershadow.net/d/mapview/data/5952742b0b88b.html

There's a lot of functions loaded from the library for cases that 
are very rare... like error writing out hello world is actually 
detected and thrown as an exception. There's also things in for 
module initializers and class factories that you don't use, but 
it is intertwined enough that the linker isn't able to optimize 
it out.



In a larger program, you'd probably actually use this stuff so 
the cost would diminish, but for a small program it is a bit 
tangled at this level.


Clean Executable

2017-06-27 Thread FoxyBrown via Digitalmars-d-learn
How can we clean an exe from the junk library functions that are 
not actually used by an app. e.g., a hello world program 
shouldn't be 500+kb. I release there are necessary extras like 
the GC, but hell, in a hello world program is it even necessary? 
Does Writeln even use the GC to display a single string?


Seems like D just does not optimize the binaries size. I know 
it's only 500kb, but still.