MATLAB Compiler    

Loop Simplification

(optimize_integer_for_loops) This optimization detects when a loop starts and increments with integers. It replaces the loop with a much simpler loop that uses C integer variables instead of array-valued variables. The performance improvements with this optimization can be dramatic.

For example:

If you compile this with the -O none option, you get

Compiling with -O none -O optimize_integer_for_loops:on gives


  Optimizing Loops Optimizing Conditionals