Documentation

优先

Description

Optimize the generated code for increased execution efficiency, decreased RAM consumption, or a balance between execution efficiency and RAM consumption.

环境s

Default:Balance RAM and speed

Balance RAM and speed

Configure code generation settings to balance RAM and execution speed.

最大化执行速度

应用代码生成设置以最大化执行速度。

Minimize RAM

Configure code generation settings to minimize RAM consumption.

Dependencies

  • Enable this parameter by setting theLevelparameter to最大.

  • 此参数需要一个嵌入式编码器®license.

  • This parameter appears only for ERT-based targets.

提示

For each优先Level参数值,在该参数中有相应的值Detailssection. These are some important differences among these various settings:

  • If you set theLevelparameter toMinimum (debugging), the parameters in theDetailssection are set to off. The code generator does not implement optimizations that remove variables or code making it easier to debug the generated code.

  • The parameter settings forBalanced with ReadabilityBalance RAM and speedare the same except for these three parameters:

    • 重复使用不同尺寸和尺寸的缓冲区

    • 优化全局数据访问

    • Optimize block operation order in the generated code

    The above optimizations can potentially hurt readability because they cross atomic subsystem boundaries andOptimize block operation order in the generated code可能会在生成的代码中更改块执行顺序,以使其与模拟中的不同。

  • If you have limited RAM, choose theMinimize RAM环境。此设置可以使这些优化以牺牲潜在的执行速度减速为代价减少RAM:

    • 将布尔数据打包到Bitfields

    • 重复使用不同尺寸和尺寸的缓冲区

    • Use bitsets for storing state configuration

    • Use bitsets for storing Boolean data

    This setting also changes theOptimize block operation order in the generated codeImproved Code Execution Speedtooff.

For each优先Levelparameter value, this table lists the corresponding values for the parameters in theDetailssection.

Parameters 环境s Example
Level Minimum (debugging) Balanced with readability 最大
优先 Not Applicable (N/A) N/A Balance RAM and speed 最大化执行速度 Minimize RAM
Details
Use memcpy for vector assignment Off Use memcpy Function to Optimize Generated Code for Vector Assignments
memcpy阈值(字节) Off 64 64 64 64 Use memcpy Function to Optimize Generated Code for Vector Assignments
Enable local block outputs Off Enable and Reuse Local Block Outputs in Generated Code
重用本地块输出 Off Enable and Reuse Local Block Outputs in Generated Code
Eliminate superfluous local variables (expression folding) Off 最小化计算和存储在块输出处的中间结果
Reuse global block outputs Off 重复使用生成代码中的全局块输出(Embedded Coder)
Perform in-place updates for Assignment and Bus Assignment blocks Off Data copy reduction for Bus Assignment block(Embedded Coder)
Reuse buffers for Data Store Read and Data Store Write blocks Off 数据存储的数据副本读取和数据存储编写块(Embedded Coder)
Simplify array indexing Off Off Off Off 简化阵列索引中的乘法操作(Embedded Coder)
将布尔数据打包到Bitfields Off Off Off Off Optimize Generated Code By Packing Boolean Data Into Bitfields(Embedded Coder)
重复使用不同尺寸和尺寸的缓冲区 Off Off Off Reuse Buffers of Different Sizes and Dimensions(Embedded Coder)
优化全局数据访问 没有任何 没有任何 使用全球保持临时结果 没有任何 使用全球保持临时结果 Optimize Global Variable Usage(Embedded Coder)
Optimize block operation order in the generated code Off Off Improved Code Execution Speed Improved Code Execution Speed Off Remove Data Copies by Reordering Block Operations in the Generated Code(Embedded Coder)
Use bitsets for storing state configuration Off Off Off Off Reduce Memory Usage for Boolean and State Configuration Variables(Embedded Coder)
Use bitsets for storing Boolean data Off Off Off Off Reduce Memory Usage for Boolean and State Configuration Variables(Embedded Coder)

If you plan on upgrading your software, be aware that:

  • 环境theLevel优先parameters enables the latest optimizations corresponding with the above parameter settings for each subsequent release.

  • 选择Specify custom optimizationsparameter enables you to select individual parameters in theDetailssection. When you load a model in a future release, optimization parameters that were introduced in releases after you adopted the software to when you upgrade are set tooff. If you want to reduce the number of changes in the generated code when you upgrade your software, this option can be a good choice.

命令行信息

范围:OptimizationPriority
Value:'均衡'|'Speed'|'RAM'
Default:'均衡'

Recommended Settings

Application 环境
Debugging 没有影响
Traceability 没有影响
Efficiency Minimize RAM(RAM),最大执行速度(Speed),Balance RAM and speed(Balanced)
Safety precaution 没有影响

See Also

|

相关话题