Main Content

Loop unrolling threshold

Threshold on the number of iterations that determines whether to automatically unroll a for-loop and a parfor-loop

Description

App Configuration Pane: Speed

Configuration Objects: coder.CodeConfig | coder.EmbeddedCodeConfig

Specify a number of iterations to instruct the code generator whether to automatically unroll a for-loop. Loops with fewer iterations than this threshold are candidates for automatic unrolling by the code generator. This threshold applies to all for-loops and parfor-loops in your MATLAB® code. For an individual for-loop, a coder.unroll directive placed immediately before the loop takes precedence over the loop unrolling optimization. The threshold can also apply to some for-loops produced during code generation.

Settings

5 | positive integer

Threshold above which a loop is a candidate for unrolling by the code generator. The default is 5.

Programmatic Use

Property: LoopUnrollThreshold
Values: 5 | positive integer
Default: 5

Version History

Introduced in R2018b