12

本问题/评论中所述,从 32 位 .NET 迁移到 64 位 .NET 时存在某些缺点。

可能最大的优势是 64 位世界中更大的进程地址空间,但还有哪些其他优点和缺点值得注意?

4

3 回答 3

6

对于一些计算量大(数字运算)的应用程序,我已经看到它明显更快(根据我的经验大约是 4 倍)。最好的事情是它在纯托管情况下是免费的。你甚至不需要重新编译任何东西来获得好处。另外,我听说 x64 JIT 有更积极的优化。

最大的缺点可能是无法在进程中加载​​ 32 位 COM 组件。

于 2009-07-08T20:41:09.190 回答
5

您的应用程序可能会或可能不会运行得更快。我已经看到了一些应用程序的改进,但没有看到其他应用程序。这取决于您的应用程序在多大程度上利用了 64 位(数学)运算,以及这是否会抵消 x64 使用的较大数据和代码,因此必须在执行之前将其加载到指令和数据缓存中。

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

这值得一读。它很旧(.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

在编译器开关等方面有很多好的指针。

于 2009-07-08T21:42:51.000 回答
1

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/

Larger pointers means more memory and cache consumption, and the number of bytes of CPU cache available is the same for both 32-bit and 64-bit processes.

http://blogs.msdn.com/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx

A 64 bit address space for the process isn’t going to help you with page faults except in maybe indirect ways, and it will definitely hurt you in direct ways because your data is bigger. In contrast a 64 bit operating system could help you a lot! If you’re running as a 32 bit app on a 64 bit OS then you get all of the 4G address space and all of that could be backed by physical memory (if you have the RAM) even without you using 64 bit pointers yourself.

于 2009-08-28T05:12:41.140 回答