Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the pros/cons of 64 bit .NET?

As mentioned in this question/comments there are certain disadvantages when moving from 32 bit .NET to 64 bit .NET.

Probably the biggest advantage is the much bigger process address space in the 64 bit world, but what other pros and cons are worth noting?

like image 233
Brian Rasmussen Avatar asked Jul 08 '09 20:07

Brian Rasmussen


People also ask

What is the difference between 32 and 64-bit Windows?

What Are 32-Bit and 64-Bit? When it comes to computers, the difference between 32-bit and a 64-bit is all about processing power. Computers with 32-bit processors are older, slower, and less secure, while a 64-bit processor is newer, faster, and more secure.

What is the difference between 32-bit and 64-bit Windows 10?

Windows 10 64-bit supports up to 2 TB of RAM, while Windows 10 32-bit can utilize up to 3.2 GB. The memory address space for 64-bit Windows is much larger, which means you need twice as much memory than 32-bit Windows to accomplish some of the same tasks.

What is a 64-bit operating system?

What is a 64-bit processor (64-bit computing)? A 64-bit processor refers to a microprocessor that can process data and instructions in chunks of 64 bits. Microprocessors that can handle 64 bits perform a larger number of calculations per second compared to 32-bit processors.


2 Answers

I've seen it to be noticeably faster (~ 4x in my experience) for some computationally-heavy (number-crunching) applications. The best thing is it comes for free in pure managed cases. You don't even have to recompile anything to get the benefits. Also, I've heard that the x64 JIT has more aggressive optimizations.

The biggest disadvantage is probably not being able to load 32-bit COM components in process.

like image 71
mmx Avatar answered Sep 28 '22 00:09

mmx


Your application may or may not run faster. I've seen improvements for some applications but not others. It depends on how much your application takes advantage of 64 bit (math) operations and if this offsets the larger data and code that x64 uses and therefore has to load into instruction and data cache before it can be executed.

http://blogs.msdn.com/b/joshwil/archive/2006/07/18/670090.aspx

This is worth a read. It's old (.NET 2.0) but much still applies; pointer sizes, COM interop etc:

Migrating 32-bit Managed Code to 64-bit

It's also worth knowing that even on x64 the CLR has a single object size restriction of 2Gb. This isn't an issue for 99% of scenarios but if you're moving to x64 presumably it's because you might be working with large data sets. See here for more discussion:

Are C# Strings (and other .NET API's) limited to 2GB in size?

So. Unless your application uses data that doesn't fit into 32 bit memory or makes heavy use of 64 bit operations you may not see much, if any improvement.

The other downside is that Visual Studio for x64 applications has some limitations:

  • Edit and Continue is not available for 64-bit debugging.

  • You cannot debug in mixed-mode, calls from native code to managed code, or vice versa, in 64-bit code.

See: http://msdn.microsoft.com/en-us/library/ms184681(VS.80).aspx

Note: The 64 bit C++ compilers aren't installed by default. You have to select them during the install.

I also just found this (because I'm optimising a x64 application myself).

"Porting and Optimizing Applications on 64-bit Windows for AMD64 ..."

http://download.microsoft.com/download/5/b/5/5b5bec17-ea71-4653-9539-204a672f11cf/AMD64_PortApp.doc

Has lots of good pointers on compiler switches and the like.

like image 39
Ade Miller Avatar answered Sep 28 '22 01:09

Ade Miller