views:

199

answers:

2

I have just installed the Platform SDK for Windows Server 2008 and .NET 3.5 on my new system, and for the first time tried to compile a project for WIN64. The Unicode Release version of that program, built for 32 bit (using the optimizing compiler from the no longer available Free Toolkit), comes in at about 2.8 MB. Using the amd64 compiler from the latest PSDK the program is more than 5 MB big.

I'm most concerned with program size, so everything is built with /O1 switch. I was expecting the program to become larger when built for 64 bit, but not that much. The size is more in line with a build from the Express version, where (some) optimizations are not available.

Do the compiler in the PSDK and the compiler from MSVC 2008 Professional create programs of very different sizes? Does the compiler in the PSDK optimize in the same way, or even at all?

Thanks for any insight.

Edit:

The program and all linked libraries are built using the same makefile.vc on the command line, so differences in compilation settings are not likely. I basically just used another command file to start a shell with proper environment for 64 bit compilation.

Here are the sizes for the application:

    VC++ Toolkit 2003   32 bit   cl.exe: 13.10.3052 for 80x86       2.916.352
    Platform SDK        32 bit   cl.exe: 15.00.30729.01 for 80x86   2.881.536
    Platform SDK        64 bit   cl.exe: 15.00.21022.08 for x64     5.138.432

So the 64 bit version is 78% larger :-(

A: 

I highly doubt that it's the optimizer. The difference in program size probably has to with debugging information and/or static libraries being linked in. Make sure you're not linking against any static libraries you don't need.

Adam Rosenfield
+1  A: 

A 64-bit binary will be larger than a 32-bit binary due to code side differences, static data, etc. Our project comes in at 7.1MB (x86) vs 10.7MB (x64), and that is for a significant amount of code. Nearly doubling sounds excessive, unless you have a lot of pointer sized static data.

Make sure you are linking with /OPT:REF to discard any unreferenced symbols.

Rob Walker
/OPT:REF did not make any difference at all, it is documented to be the default. The size difference seems to be very large IMHO, but if you have about 40% increase too I guess there's not much I can do about it. I'm still interested in a definite answer about compiler differences, though.
mghie
I accept this answer, even though it doesn't say whether the compilers produce the same output. Seems like no one did ever compile their code with both. As I don't have the Visual Studio Pro version it will remain a mystery to me ;-)
mghie