所述“优化代码"包括: Visual Studio中的复选框.它到底是做什么的? [英] The "Optimize code" checkbox in Visual Studio. What exactly does it do?

查看:125
本文介绍了所述“优化代码"包括: Visual Studio中的复选框.它到底是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2005/2008中项目属性"的生成"选项卡包含优化代码".

The Build tab of the Project Properties in Visual Studio 2005/2008 contains the "Optimize code".

文档指出,它"...启用或禁用由编译器执行的优化,以使输出文件更小,更快和更高效."

The documentation states that it "... enables or disables optimizations performed by the compiler to make your output file smaller, faster, and more efficient."

  1. 我的问题是为什么我不应该戴它?
  2. 为什么默认情况下不启用它?
  3. 它实际上是做什么的?

推荐答案

  1. 您不希望在构建调试时使用此功能,因为它会使逐步执行代码变得更加困难,因为正在运行的实际代码可能无法正确反映您所编写的内容(因为某些行将被优化)

  1. You wouldn't want this on for a debug built, as it makes stepping through code harder as the actual code that is running may not properly reflect what you have written (since some lines will be optimized out)

由于上述原因,DEBUG构建默认情况下未启用该功能,应在发行版本中默认启用该功能

It is not on by default for DEBUG builds for the above reason, it should be enabled by default on release builds

它执行优化,例如动态内联和删除不需要的局部变量.可以在编译时决定的任何类型的优化.

It performs optimizations such as dynamic inlining and removing unneeded local variables. Any sort of optimization that can be decided upon at compile time.

这篇关于所述“优化代码"包括: Visual Studio中的复选框.它到底是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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