MSP430应用技巧6:代码速度的优化


    CCS中有一个选项 --opt_for_speed由于控制代码大小和代码运行速度,将其设为0则可达到代码最小化/运行速度最慢,将其设为5则可达到运行速度最快化/代码最大。我们可以在0-5之间进行选择做一个权衡。CCS中提供一个工具 Optimizer Assistant可以对0-5的所有选项进行编译和链接,从而找到一种最佳的方案。
    我们可以通过菜单
View->Other->Code Composer Studio->Optimizer Assisatan打开该工具,工具运行完毕后,绿色箭头标明是当前的选项,绿色bar是最佳选项,红色是失败选项。
    我觉得知道上面就足够了,如果希望深入了解,本文后付英文原文和翻译,以供参考。 
 

    The option --opt_for_speed controls the tradeoff(权衡) between size and speed(0-5 range). Setting --opt_for_speed=0 enables optimizations geared towards(朝...调整) improving code size with a high risk of worsening or impacting(压缩) perforamnce.At the other extreme, setting --opt_for_speed=t enables optimization geared towards improving the code performance/speed with a hihg risk of worsening or impacting code size.Setting between 0 and 5 vary(变化) the emphasis on performance(对抗) code size.选项
--opt_for_speed用于在代码和运行速度之间取一个权衡,其范围在0-5之间。设置 --opt_for_speed为0则可以使优化有利于控制代码大小,而丧失代码性能。另一个极端是将 --opt_for_speed设置为5,则有利于提升代码性能和速度,而使得代码尺寸会相应增大。将这个参数设为0-5之间,可以在这两点之间做一个很好的权衡。
    Use the Optimizer Assistant feature to build your project for all setttings of --opt_for_speed. You can either double click on the Advice View entry, or select menu  View->Other->Code Composer Studio->Optimizer Assisatan.使用优化助手可以对
--o pt_for_speed选项的所有设置进行全编译,我们可以通过以下菜单打开, View->Other->Code Composer Studio->Optimizer Assisatan。
    You will see below.你将看到下图。
    图片 

    Select "speed vs. size trade-offs"(or you can select to vary by optimization level), and CCS will build your project with all settings for selected option to vary. The results window will update during the build run.
图片 
    
    Final results will show a bar chart of code size for each --opt_for_speed setting. Any builds that faild link will show in red. In below results window, the green check mark represents current setting --opt_for_speed, and the green is recommended setting.
图片 

 
 
原创性文章,转载请注明出处  http://user.qzone.qq.com/2756567163  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

snmplink

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值