lua-users home
lua-l archive

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


On 2010-03-17, Mike Pall <mikelu-1003@mike.de> wrote:
> [..snip..]
>  But let's turn that around: what would you (not just you, Duncan)
>  like to see in such an API? What would you like to do with it?
>  What might help to make it simpler and easier to maintain?
>  Real-life examples are preferred of course.
>

Real time examples at hand: numerical computations and simulations.
Typically, non-trivial numeric algorithms are hard to get right and,
therefore, multiple sophisticated numerical libraries have been
developed over the years that solve certain parts of your problem:
BLAS/LAPACK for linear algebra, GSL or netlib for many other things,
ROOT for everything, etc.
Very often a task of writing a complete numeric program is a task of
gluing those libraries together within a certain context and
scientific logic. And, IMHO, LuaJIT, for one thing, is a very good
glue for that. And for numeric applicaitons good performance is
paramount. I feel real pain when calling from LuaJIT simple
lightweight C++ complex number functions, for it uses more CPU cycles
operating on Lua stack than calling the function body itself ( +-*/ of
two complex numbers come to mind first). And there are many other
examples like that.

Another problem is memory management. In order to harmonize Lua GC
controlled userdata objects with C++ way of memory management I am
currently binding to reference counted wrapper objects. It works fine
but causes some moderate performance degradation due to extra pointer
references and need to maintain ref counts.

C++/Lua inheritance harmonization is yet another story altogether.

Just my two cents.
--Leo--