.Net2 assemblies hosted in .Net4 app perform better in x86 than in AnyCpu mode?

匆匆过客 提交于 2019-12-07 05:28:29

问题


I have a .Net4 WinForms app that references 3rd party .Net2 assemblies, which contain graphics-heavy visual controls. I've noticed a huge improvement in app's visual performance when I accidentally switched it from AnyCpu to x86 compilation mode. My development rig is a x64 Windows 7. The improvement is by a factor of at least two when controls are rendering their graphical elements.

Is this a known fact or am I doing something wrong?


回答1:


See these two articles about it:

AnyCPU Exes are usually more trouble than they're worth

Visual Studio: Why is there no 64 bit version? (yet)

See also this post about 64-bit code: Should I choose to take advantage of 64-bit?, it clearly states that for example Paint.NET works better under in 64-bit mode, because the developer optimized the code for 64-bit.

So, I don't think you are doing something wrong, but maybe the 3rd party .NET assemblies you're using could be improved specifically when running in a 64-bit process.




回答2:


This wouldn't surprise me. When you set the application to compile to "Any CPU", the CLR generates an application that the jiter on the user's machine must further compile to best fit their architecture. If you set it to "x86", your dev compiler compiles the application for an x86 machine, which reduces the load of the clients jiter.



来源:https://stackoverflow.com/questions/7161080/net2-assemblies-hosted-in-net4-app-perform-better-in-x86-than-in-anycpu-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!