lua-users home
lua-l archive

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


On Thu, Feb 17, 2011 at 05:26, T T <t34www@googlemail.com> wrote:
> On 17 February 2011 10:00, steve donovan <steve.j.donovan@gmail.com> wrote:
>> On Thu, Feb 17, 2011 at 11:48 AM, T T <t34www@googlemail.com> wrote:
>>>  vec3 = vec1 + vec2
>>>
>>> to add together two arrays and the good elves take care of the rest,
>>> but in Lua we have to write loops.
>>
>> Well, it's traditionally done with objects, and this creates a great
>> deal of garbage (I recall Leo talking about this very thing.) The
>> elves turn out to be quite expensive.
>
> MATLAB implements those quite efficiently, but that besides the point
> of this discussion.

Actually these good elves are called BLAS (and for certain operations
LAPACK) that MATLAB uses internally. Vectorization only happens with
built-in containers such as vectors and matrices. For user defined
types the recommended way to boost performance  involves implementing
everything in C and hooking into MATLAB with mx interface.
As far as the MATLAB interpreter/JIT is concerned it is hopelessly
slow so that using MATLAB in event-driven simulations that require
explicit loops and lots of branching is PITA.
IMHO, the best thing that could happen to MATLAB is to switch to Lua,
license Mike's LuaJIT and port their cool toolboxes to it.

--Leo--