On Monday, 4 January 2016 at 13:49:03 UTC, Martin Tschierschke
wrote:
When I was writing a small speed test - D versus Ruby,
calculating the first n prime numbers, I realized, that for
small n
Ruby may be faster, than compiling and executing with D.
But for n = 1,000,000 D outperforms Ruby by app. 10x.
Looking at the size of my prime executable, it was around 800
kB with DMD
and even with optimization and "gdc -Os" > 1 MB.
Why is such a short program resulting in a so big binary?
You have the runtime and phobos compiled with your program. But
also:
- if debug info are generated this increases the size.
- if bounds checking is turned off there is some code generated
for each array operation
- if contracts are not off there is a lot of assertion that will
be generated
see also some clues here:
http://forum.dlang.org/post/mailman.20.1441974998.22025.digitalmars-d-le...@puremagic.com