User`s guide
6 Optimizing Performance
6-8
Note This optimization causes the variable names in the resulting C
program to differ from those in the M-file. Therefore, it is recommended that
you do not use this option when debugging.
For example,
function test(x)
for i = 1:length(x)-1
x(i) = x(i) + x(i+1)
end
If you compile this with the -O none option, you get
...
{
mclForLoopIterator viter__;
for (mclForStart(
&viter__,
mlfScalar(1),
mclMinus(mclVe(mlfLength(mclVa(x, "x"))),
mlfScalar(1)), NULL);
mclForNext(&viter__, &i);
) {
...
}
mclDestroyForLoopIterator(viter__);
}
...
Compiling with -O none -O optimize_integer_for_loops:on gives
...
{
int v_ = mclForIntStart(1);
int e_ = mclForIntEnd(mlfScalar(mclLengthInt(mclVa(x, "x"))
- 1));
if (v_ > e_) {
mlfAssign(&i, _mxarray0_);
} else {