I use C#, .NET, VS.NET 2008.
Besides being able to address more memory, what are the advantages to compiling my application to 64-bit?
Is it going to be faster or smaller? Why?
Does it make it more compatible with a x64 system (when compared to a 32-bit application)?
Simply put, a 64-bit processor is more capable than a 32-bit processor because it can handle more data at once. A 64-bit processor can store more computational values, including memory addresses, which means it can access over 4 billion times the physical memory of a 32-bit processor.
With 64 bit memory addresses the application can access more memory than its 32 bit equivalent. In addition 64 bit programs will work "better" than 32 bit ones as they are using the native system architecture. Operations such as memory reads are performed natively etc.
Benefits of 64-Bits: The main perks gained from installing a 64-bit version of Windows are the ability to access RAM above the 4-GB range and the advanced security features. The access to more memory allows for more efficiency when administering processes and consequently improves performance of the OS.
In general any 32 bit program runs slightly faster than a 64 bit program on a 64 bit platform, given the same CPU.
For native applications, you get benefits like increased address space and whatnot. However, .NET applications run on the CLR which abstracts away any underlying architecture differences.
Assuming you're just dealing with managed code, there isn't any benefit to targeting a specific platform; you're better off just compiling with the "anycpu" flag set (which is on by default). This will generate platform agnostic assemblies that will run equally well on any of the architectures the CLR runs on.
Specifically targeting (say) x64 isn't going to give you any performance boost, and will prevent your assemblies from working on a 32-bit platform.
This article has a bit more information on the subject.
Update: Scott Hanselman just posted a good overview of this topic as well.
In theory, a program compiled for x64 will run faster than a program compiled for x86. The reason for this is because there are more general purpose registers in the x64 architecture. 32-bit x86 has only 4 general purpose registers. AMD added an additional 8 general purpose registers in their x64 extensions. This allows for fewer memory loads and (slightly) faster performance.
In reality, this doesn't make a huge difference in performance, but it should make a slight one.
The size of the binary and the memory footprint will increase somewhat from using 64-bit instructions but because x64 is still a CISC archictecture, the binary size does not double as it would in a RISC architecture. Most instructions are still shorter than 64 bits in length.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With