DMD1 binaries a lot bigger than DMD2 due to weird zero blocks?

Leandro Lucarella luca at llucax.com.ar
Thu Aug 5 07:13:37 PDT 2010


Vladimir Panteleev, el  5 de agosto a las 02:23 me escribiste:
> Consider a simple "Hello, world" program:
> 
> import std.c.stdio;
> 
> void main()
> {
> 	printf("Hello, world!\n");
> }
> 
> When compiled with DMD 1.062 and DMD 2.047:
> 
> C:\Downloads\dmd.1.062\dmd\windows\bin> dmd hello.d
> C:\Downloads\dmd.1.062\dmd\windows\bin> ls -l hello.exe
> -rwxrwxrwx  1 Vladimir 0 177180 2010-08-05 02:17 hello.exe
> 
> C:\Downloads\dmd.2.047\dmd2\windows\bin> dmd hello.d
> C:\Downloads\dmd.2.047\dmd2\windows\bin> ls -l hello.exe
> -rwxrwxrwx  1 Vladimir 0 101404 2010-08-05 02:19 hello.exe
> 
> Notice that there is a 74 KB difference. A quick look with a hex
> editor / disassembler reveals multiple zero-filled blocks between
> functions.
> 
> What is causing this? Both versions use the same linker, so it would
> have to be caused by DMD or the precompiled libraries?

I had a weird problem, a program became 3x slower after a small change,
that couldn't cause that. Adding a line of code to an unrelated function
that wasn't even executed (one of the tests I done was putting abort()
as that extra line), make the program behaves the same as before the
change. My only guess was that the compiler is aligning differently in
the binary or something, but I never reported the bug because it was
impossible to narrow down to a small test case.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
In 1995 a Japanese trawler sank, because a Russian
cargo plane dropped a living cow from 30,000 feet


More information about the Digitalmars-d mailing list