Visual C++ 9个编译选项让程序运行更快
我从源代码构建了一个开源应用程序。不幸的是,原始可执行文件的运行速度明显更快。我尝试启用一些编译器优化,但结果不够令人满意。我还需要在 Visual Studio 2008 中做什么来提高可执行性能?
谢谢!
I have built an open-source application from the source code. Unfortunately, the original executable runs significantly faster. I tried to enable few compiler optimizations, but the result wasn't satisfactory enough. What else do I need to make in Visual Studio 2008 to increase the executable performance?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
基本上尝试在项目设置中启用“优化”下的所有内容,然后确保打开“链接时间代码生成”,启用功能级链接和完整 COMDAT 折叠(这只会减小 EXE 的大小,但有助于缓存),并关闭诸如此类的安全功能通过定义 _SECURE_SCL=0 即可。请记住,其中一些设置还有其他含义,尤其是安全方面的含义。
Basically try enabling everything under Optimisation in project settings, then ensure Link Time Code Generation is on, enable Function-level linking and full COMDAT folding (that only reduces the size of the EXE but could help with caching), and turn off security features such as by defining _SECURE_SCL=0. Remember some of these settings have other implications, especially the security ones.
定义_SECURE_SCL=0。
http://msdn.microsoft.com/en-us /library/aa985896(VS.80).aspx
Define _SECURE_SCL=0.
http://msdn.microsoft.com/en-us/library/aa985896(VS.80).aspx
编译时尝试启用SSE指令。另外 - 您可以尝试使用不同的编译器(GNU GCC)进行编译。
+可能启用了一些调试定义,这也会降低速度。
+检查,原始 .exe 的版本与您尝试编译的版本相同。
Try to enable SSE instructions, when compiling. Also - you can try to compile using different compiler (GNU GCC).
+There might be enabled some debug defines, shich also can reduce speed.
+Check, that original .exe has same version as one you are trying to compile.
开源预编译二进制文件很可能(不知道您正在使用哪个项目)使用 GNU GCC(Windows 上的 Mingw)编译。这可能是它更快的原因。根据问题:性能g++与VC++有些事情是如果使用 VC++,速度会慢得多。
The open-source precompiled binary is most likely (whit out know which project you are working with) compiled with GNU GCC (Mingw on Windows). That might be the reason that it is faster. According to question: performance g++ vs. VC++ some things are considerably slower if you use VC++.