[英]Performance of a C# application built on AnyCPU vs x64 platform on a 64 bit machine
I have to deploy a C# application on a 64 bit machine though there is a slight probability that it could also be deployed on a 32 bit machine. 我必须在64位计算机上部署C#应用程序,尽管它也可能部署在32位计算机上。 Should I build two separate executables targeting x86 and x64 platform or should I go for a single executable built targeting 'AnyCPU' platform (specified in the project property's Build option'. Would there be any performace difference between a C# assembly built targeting 'AnyCPU' is deployed on a 64 bit machine vs the same assembly built targeting specifically 'x64' platform ?
我应该构建两个针对x86和x64平台的独立可执行文件,还是应该针对“AnyCPU”平台(在项目属性的“构建”选项中指定)构建单个可执行文件。在C#程序集构建的目标“AnyCPU”之间是否存在任何性能差异?部署在64位计算机上与相同的程序集部署专门针对'x64'平台?
No, there is no difference in performance between AnyCPU application running on a 64-bit Windows and an x64 application running on it. 不,在64位Windows上运行的AnyCPU应用程序与在其上运行的x64应用程序之间的性能没有差异。 The only thing that flag changes are some flags in the header of the compiled assembly and the CLR uses it only to decide whether to use x86 or x64, nothing else
标志更改的唯一内容是编译程序集的标头中的一些标志,CLR仅使用它来决定是使用x86还是x64,没有别的
If you were asking whether there is a difference between x86 application running on a 64-bit Windows and an x64 (or AnyCPU), then the answer would be yes. 如果您在询问在64位Windows上运行的x86应用程序与x64(或AnyCPU)之间是否存在差异,那么答案是肯定的。 The differences between the two are:
两者之间的差异是:
tail.
tail.
特别请求它tail.
instruction (which for example C# never does) As a side note to the above answer. 作为上述答案的旁注。 There can be issues with using P/Invoke or DotNetInterop into x86 DLL's on an x64 OS using AnyCPU.
使用AnyCPU在x64操作系统上使用P / Invoke或DotNetInterop进入x86 DLL 可能会出现问题。 In the case where no 64-bit version of the DLL is available, it may be necessary to compile x86 rather than AnyCPU as the OS will try to load the 64-bit version...and fail.
在没有64位版本的DLL可用的情况下,可能需要编译x86而不是AnyCPU,因为操作系统将尝试加载64位版本......并且失败。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.