MATLAB Compiler | ![]() ![]() |
Simple Indexing
(array_indexing
) This optimization improves the performance of simple one- and two-dimensional array index expressions. Without this optimization, all array indexing uses the fully general array indexing function, which is not optimized for one- and two-dimensional indexing. With this optimization enabled, indexing uses faster routines that are optimized for simple indexing. For example,
function y = test(x,i1,i2); y = x(i1,i2);
If you compile this with the -O none
option, you get
... mlfAssign( &y, mlfIndexRef(mclVsa(x, "x"), "(?,?)", mclVsa(i1, "i1"), mclVsa(i2, "i2"))); ...
Compiling with -O none -O array_indexing:on
gives
... mlfAssign( &y, mclArrayRef2(mclVsa(x, "x"), mclVsa(i1, "i1"), mclVsa(i2,"i2"))); ...
The mclArrayRef2
function is optimized for two-dimensional indexing. mclArrayRef1
is used for one-dimensional indexing.
![]() | Nonscalar Arrays | Loop Simplification | ![]() |