lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 2009-11-06, David Kastrup <> wrote:
>  >  Matlab is _known_ to suck at scalar code and nested loops.  Nobody uses
>  it in that manner for serious number crunching.  What you do is convert
>  your task into a matrix operation task.  At times that takes quite a bit
>  of ingenuity.  It helps that you can index a matric or vector using a
>  vector (and getting a vector), and the vectors of form a:b (a range) are
>  often optimized away into explicit code/loops.
>  There are tutorials and stuff around for maximizing Matlab performance.
>  And the main point is to avoid scalar operations.
>  --
> David Kastrup

I think you did not read my email carefully:-) After professionally
working with MATLAB for more than a decade I know how to use vectors
and matrices and how to avoid scalar operations for simple control
flows. But if you have non-trivial logic in your loop constructs
or/and you are doing event driven processing you cannot vectorize.
These days MATLAB is used (and abused) for much more than just a
matrix calculator it once was.

I deliberately have chosen scalar operations test because I wanted an
apple-to-apple comparison between two JIT compilers. In case of
vectorized algorithms MATLAB will spend most of the time inside its
highly optimized numeric libraries and it tells you nothing about
MATLAB's own JIT performance.