Main Content

Compiler optimization level

Degree of compiler optimization when generating code for simulation

Model Configuration Pane: Simulation Target

Description

This parameter specifies the degree of optimization used by the compiler that generates code for simulation. The software generates a simulation target for the model in:

  • Accelerator mode simulation

  • Rapid accelerator mode simulation

The software generates a simulation target for normal mode simulation for:

  • Referenced models that simulate in accelerator mode

  • Stateflow® charts

  • MATLAB Function blocks

  • MATLAB System blocks

Whether the compiler optimizes the generated code affects the amount of time required to build the simulation target and the execution of the simulation target in simulation.

  • Optimizing the generated code increases the build time but can result in faster execution during simulation.

  • Skipping optimization decreases the build time but can result in slower execution during simulation.

Settings

Optimizations off (faster builds) | Optimizations on (faster runs)
Optimizations off (faster builds)

The compiler does not optimize the code, which results in faster simulation target builds but can result in slower execution during simulation.

This setting is an appropriate choice for most models.

Optimizations on (faster runs)

The compiler optimizes the code, which results in slower builds but can result in faster execution in simulation.

This setting can be helpful when you run many simulations without rebuilding the simulation target.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: SimCompilerOptimization
Type: string | character vector
Values: 'on' | 'off'
Default: 'off'

Version History

Introduced in R2008a