64 位 .NET 的优点/缺点是什么?
正如这个问题/中提到的从 32 位 .NET 迁移到 64 位 .NET 时存在某些缺点。
最大的优势可能是 64 位世界中更大的进程地址空间,但是还有哪些其他优点和缺点值得注意?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我发现对于一些计算量大(数字运算)的应用程序来说,它的速度明显更快(根据我的经验大约是 4 倍)。 最好的事情是它在纯托管案例中是免费的。 您甚至无需重新编译任何内容即可获得好处。 另外,我听说 x64 JIT 有更积极的优化。
最大的缺点可能是无法在进程中加载 32 位 COM 组件。
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.
您的应用程序可能运行得更快,也可能不会。 我看到了某些应用程序的改进,但其他应用程序却没有看到改进。 这取决于您的应用程序利用 64 位(数学)运算的程度,以及这是否抵消了 x64 使用的较大数据和代码,因此必须先加载到指令和数据缓存中,然后才能执行。
链接
这值得一读。 它很旧(.NET 2.0),但很多内容仍然适用; 指针大小、COM 互操作等:
将 32 位托管代码迁移到 64 位
还值得注意的是,即使在 x64 上,CLR 也有 2Gb 的单个对象大小限制。 对于 99% 的场景来说,这不是问题,但如果您要迁移到 x64,可能是因为您可能正在处理大型数据集。 请参阅此处了解更多讨论:
是 C#字符串(和其他 .NET API)的大小限制为 2GB?
那么。 除非您的应用程序使用不适合 32 位内存的数据或大量使用 64 位操作,否则您可能看不到太多改进(如果有的话)。
另一个缺点是 Visual Studio for x64 应用程序有一些限制:
编辑并继续不可用
用于 64 位调试。
您无法在混合模式下调试,调用
从本机代码到托管代码,或者
反之亦然,在 64 位代码中。
请参阅:http://msdn.microsoft.com/en -us/library/ms184681(VS.80).aspx
注意:默认情况下不安装 64 位 C++ 编译器。 您必须在安装过程中选择它们。
我也刚刚发现了这个(因为我自己正在优化 x64 应用程序)。
“在 64 位 Windows 上针对 AMD64 移植和优化应用程序...”
http://download.microsoft.com/download/5/b/5/5b5bec17-ea71-4653-9539-204a672f11cf/AMD64_PortApp.doc
有很多很好的指针关于编译器开关等。
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.
Link
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.
64 位应用程序并不总是比 32 位应用程序运行得更快。
下面的两篇博文对此进行了讨论:
https://blogs.msdn.microsoft.com/rmbyers/2009/06/09/anycpu-exes-are-usually-more-trouble-than-theyre-worth/
http://blogs.msdn.com/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx
64 bit apps will not always run faster than 32 bit.
The two blog posts below talks about it:
https://blogs.msdn.microsoft.com/rmbyers/2009/06/09/anycpu-exes-are-usually-more-trouble-than-theyre-worth/
http://blogs.msdn.com/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx