Reputation: 1497
I am trying to understand what are the differences in the development of .Net apps on both x86 and x64 architecture. Let's say I've developed an app on both x64 and x86 with the same source and my configuration was anycpu(or it can be x64 with the x64 machine). Will these applications both run with the same performance on x64 architecture. To sum up my question, while targeting x64 architecture for its benefits, say more memory than 4gb, applications that are developed on x64 machines have any advantage over applications that are developed on x86 with the configuration of anycpu?
Upvotes: 1
Views: 172
Reputation: 6850
As Reed Copsey says, they will run with the same performance.
Performance considerations aside, though, I just wanted to add that you should still try to test the application on an x64 machine if possible. I've seen a couple gotchas that can happen with AnyCPU applications:
Native DLLs only work on one architecture. For example, if your application is compiled for AnyCPU but uses a 32-bit native DLL, then it will run just fine on x86 but crash on x64 because a 64-bit process won't be able to use that DLL.
Relying on IntPtr being a specific size. For example, if you assume its size is 4 bytes that's going to cause bugs when it's running as a 64-bit process, where sizeof(IntPtr)
is 8.
Upvotes: 0
Reputation: 564323
Will these applications both run with the same performance on x64 architecture. To sum up my question, while targeting x64 architecture for its benefits, say more memory than 4gb, applications that are developed on x64 machines have any advantage over applications that are developed on x86 with the configuration of anycpu?
No. Applications targetting AnyCPU will run exactly the same on x64 as if they target x64. AnyCPU will cause the application, when run on a 64bit OS, to use the 64bit CLR (exactly the same way as if it is built targetting x64.)
They will run differently on 64bit systems than they do on your 32bit operating system, however, as the 64bit CLR does have different optimization and performance characteristics.
Upvotes: 2