MDK优化等级说明

原文

0     Minimum optimization. Turns off most optimizations.It gives the best possible debug view and the lowest level of optimization.

            近乎不优化,用于调试代码。出现代码行不能设置断点可如此设置试试。

1          Restrictedoptimization. Removes unused inline functions and unused static functions.Turns off optimizations that seriously degrade the debug view. Ifused with --debug, this option gives a satisfactorydebug view with good code density.

部分优化。移除未调用的内联函数和静态函数,关闭debug窗口优化,此状态也能用于调试

2          Highoptimization. If used with --debug, the debug viewmight be less satisfactory because the mapping of object code tosource code is not always clear.

This is the default optimization level.

            默认优化等级。如果处于debug状态,部分代码行将不能被调试,具体做了什么优化好像没说

3     Maximumoptimization. -O3 performs the same optimizationsas -O2 however the balance between space and timeoptimizations in the generated code is more heavily weighted towardsspace or time compared with -O2. That is:

-O3 -Otime aims to produce fastercode than -O2 -Otime, at the risk of increasingyour image size

-O3 -Ospace aims to produce smallercode than -O2 -Ospace, but performance might bedegraded.

In addition, -O3 performs extra optimizationsthat are more aggressive, such as:

High-levelscalar optimizations, including loop unrolling, for -O3 -Otime. Thiscan give significant performance benefits at a small code size cost,but at the risk of a longer build time.

More aggressive inlining and automatic inliningfor -O3 -Otime.

-O0
最少的优化,可以最大程度上配合产生代码调试信息,可以在任何代码行打断点,特别是死代码处。

-O1
有限的优化,去除无用的inline和无用的static函数、死代码消除等,在影响到调试信息的地方均不进行优化。在适当的代码体积和充分的调试之间平衡,代码编写阶段最常用的优化等级。

-O2
高度优化,调试信息不友好,有可能会修改代码和函数调用执行流程,自动对函数进行内联等。

-O3
最大程度优化,产生极少量的调试信息。会进行更多代码优化,例如循环展开,更激进的函数内联等。

另外,可以通过单独设置 --loop_optimization_level=option 来控制循环展开的优化等级。
————————————————
版权声明:本文为CSDN博主「AdamFriedrich」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/liuqi3256797/article/details/90137350

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值