问题描述
我们已经用VB .NET 4.0 / VS2010编写了.NET应用,该应用的所有项目均已设置为Debug和Release配置的AnyCPU设置。我们注意到,当此应用程序在64位环境(在Windows Server 2003 R2和2008 R2上测试)上运行时,该应用程序至少花了两倍的时间(绝对值约25秒),而不是大约6-12倍在32位环境(Win XP和7)上启动的第二秒。
我应该补充一点,64位系统是功能强大的服务器,绝对比其他经过测试的系统功能强大32位系统。所有其他应用程序在64位上都运行得更快,但不是我们的劣质应用程序;)(而且我们确实在不同的时间,不同的负载下测试了这些应用程序,结果始终几乎相同。)
如上所述,该应用程序是使用AnyCPU构建的,并且确实在64位操作系统(通过TaskManager检查)下作为64位程序集运行。该应用程序本身是WinForms应用程序,它使用NetAdvantage Forms v10.3,并定期查询和写入MS SQL Server 2008。
所有目标计算机都处于运行状态相同的网络,因此数据库的路径(例如,用于性能测试的相同数据库)是相同的,我不认为问题出在数据库或网络本身附近。
我确实注意到的一件事,对我来说似乎很奇怪,那就是当我在MainForm启动期间使用秒表构建不同的分析步骤时,InitializeComponent方法在64位上花费了两倍的时间,大约是4秒,而在32位上花费了1.5秒。
这是我们在两个系统上部署的相同应用程序,没有不同的配置。 / p>
所以我有两个问题:
任何人都知道这可能是什么原因吗?
并且:确定违规代码段的最佳方法是什么?目前,我使用秒表并尝试缩小范围。但就我的应用程序而言,在我看来,这一切在64位计算机上都比较慢,因此我不太确定能否将其分解为特定的语句。
感谢您的帮助,非常感谢...
原来,我们从从AnyCPU编译为专门的x86,即也可以在x64位平台上作为x86运行,我们回到了良好的速度。
We have got .NET app written in VB .NET 4.0 / VS2010, compiled with all projects set to the AnyCPU setting for both Debug and Release configuration. We have noticed that when this app is run on a 64 bit environment (tested on Windows Server 2003 R2 and 2008 R2) that the app then takes at least double as long (in absolute terms about 25 secs) as opposed to around 6-12 seconds on a 32 bit environment (Win XP and 7) to start up.
I should add that the 64 bit systems are powerful servers, definitely more powerful than the other tested 32 bit systems. All other apps were faster on 64 bit, but not our poor app ;) (And we did test the apps at different times, under different load, and the results are always pretty much the same.)
As said above, the app is built using AnyCPU and it does run as 64 bit assembly under 64 bit OS (checked via TaskManager). The app itself is a WinForms app, making use of NetAdvantage Forms v10.3 and is regularly querying and writing to MS SQL Server 2008.
The different target machines are all on the same network, so the path to the database (same database was used for the performance tests) for example is the same, I don't think the problem is around the database or the network itself.
One thing I did notice, which seemed odd to me, was that when I built in different "profiling steps" using a stopwatch during the startup of our MainForm that the InitializeComponent method took twice as long on 64 bit, around 4 seconds opposed to 1.5 on 32 bit.
It's the very same app we deploy on both systems, no different config.
So I have got two questions:
Any idea what the cause of this could be?
And: What's the best way of determining the "offending" pieces of code? Currently I use stopwatches and try to narrow it down. But it looks to me like everything is slower on the 64 bit machines as far as our app is concerned, so I am not too sure I can break it down to specific statements.
Thanks all for your help, very much appreciated...
It turned out, that as soon as we switched from compiling from AnyCPU to specifically x86, i.e. also run as x86 on a x64 bit platform, we were back to our "good speed".
这篇关于.Net 4.0应用程序在64位上比32位上慢(分析和可能的解决方案)(应用程序使用NetAdvantage)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!