VS2005 二进制文件的性能优于 VS2008 二进制文件
由使用 VS2005 构建的 C# 和 C++ 项目组成的 VS 解决方案的性能优于转换为 VS2008(发布模式)的相同解决方案。我已经仔细检查了优化设置是否存在已知错误,其中设置未正确转换。 虽然性能差异不大,但仍然值得注意。您知道造成性能差异的原因是什么吗? 预先感谢您的回复!
A VS solution consisting of C# and C++ projects built with VS2005 outperforms the same solution converted to VS2008 (release mode). I already double checked the optimization settings for the known bug where the settings are not converted correctly.
While the difference in performance is not big it is still notable. Any ideas what the reason could be for the difference in performance?
Thanks in advance for any replies!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果不知道代码是什么以及哪些开关被发送到编译器,则无法完全回答。
C# 性能不应该仅仅通过使用不同版本的 VS 重新编译而改变。如果两者位于同一台计算机上,它们将使用相同版本的 .NET Framework 来执行。
就 C++ 而言,VS 版本之间的编译器会发生变化,因此性能并不总是相同。他们很可能对优化器进行了更改,而这种更改恰好在您的代码上执行得更差,但对大多数其他代码执行得更好。他们还可以调整编译器的指令调度程序以适应更现代的“平均”CPU。 VS2008 还引入了许多 C++ 合规性修复——其中可能会减少编译器优化的空间。
Can’t answer completely without knowing what the code is and what switches are being sent to the compiler.
C# performance shouldn't have changed just by recompiling with a different version of VS. If you have both on the same machine, they'll use the same version of the .NET Framework to execute.
As far as C++ goes, the compiler changes between VS versions so perf won’t always be the same. It’s very possible they made a change to the optimizer that happens to perform worse on your code but better for most others. They could also have adjusted their compiler's instruction scheduler to account for a more modern "average" CPU. VS2008 also brought in a lot of C++ compliance fixes – there might be one that reduced the room the compiler has to optimize.