Visual C++ 编译器优化 [英] Visual C++ compiler optimization

查看:90
本文介绍了Visual C++ 编译器优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从 Dev-c++ 迁移到 Visual C++ 2010,发现它在各个方面都好得多,但只有一个方面.当我在 Dev-c++ 中编译和执行代码并切换 best-optimization 选项时,编译时间大大减少,几乎减少了一半(mingw32),但我可以在 Visual C++ 2010 中似乎没有找到任何优化选项.如何告诉编译器优化代码?

I've recently migrated from Dev-c++ to Visual C++ 2010, and found it much better within all aspects but one. When I compile and execute the code in Dev-c++ with the best-optimization option toggled, the compile time is greatly reduced, almost by half (mingw32), but I can't seem to find any optimization options in Visual C++ 2010. How can I tell the compiler to optimize the code?

推荐答案

右键单击您的项目,选择属性".现在确保您当前的配置是发布".在窗口的左侧,您应该会看到一个具有不同类别的树视图.优化选项分为 C/C++ 和链接器条目.

Right click your project, pick "Properties". Now make sure that your current configuration is "Release". In the left part of the window, you should see a tree view with different categories. Optimization options are split amongst the C/C++ and linker entries.

另外,请记住,优化意味着对生成的二进制文件进行了优化.不是实际构建二进制文件.速度提升的原因可能是因为不必添加调试代码等.但总的来说,我更可能希望构建具有优化的发布版本比创建调试版本花费的时间更长.

Also, keep in mind, that optimization means the resulting binary is optimized. NOT actually building the binary. The speed gain might be explained due to not having to add debug code etc. but in general, I'd more likely expect building a release version with optimizations to take longer than creating a debug build.

这篇关于Visual C++ 编译器优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆