Nick Sabalausky wrote:
"Ph" <roma...@gmail.com> wrote in message news:hia7qc$b5...@digitalmars.com...
Why a generated file is so huge?
"Empty" program such as:

int main(char[][] args)
{

return 0;
}

compiled with dmd2 into file with size of  266268 bytes.
Even after UPX, it's size is 87552 bytes.
Size of this code,compiled with VS(yes,yes, C++), is 6 656 bytes.
Compiler add's standard library  to file, am i right?
Is there some optimization which delete unused code from file?


That's not even a third of a megabyte, why does this keep getting brought up as an issue by so many people?

Maybe most of them don't know that it's only constant overheads.

On the other hand, template bloat can inflate binaries surprisingly much. For example, the unlinked object file of "hello world" in D1 is 2.3 KB, while in D2, it's 36 KB. That's because writefln() is a template in D2. (The final executable is almost twice the size as the D2 one too, although it's questionable how much of the additional size is due to templates.)

Reply via email to