lua-users home
lua-l archive

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

On Sun, Feb 13, 2011 at 17:34, Francesco Abbate <> wrote:
> 2011/2/13 Florian Weimer <>:
>> I wonder why you don't use C or Fortran, then.  This is not intended
>> as a snide remark.  I doubt you can use Lua effectively as a tool if
>> you don't meet it halfway.
> I use C, C++, Lua and few other programming language but I doesn't use
> Fortran :-)
> I don't have any problem with Lua, I was just wondering if it was
> possible to use it to implement efficiently numeric algorithms ...

If performance is your main concern then C/C++/Fortran and sometimes
Assembler are your only real choices especially is you a coding
against a fixed deadline. With LuaJIT2 or any other smart dynamic
optimizers fir that matter there are too many things beyond your
immediate control. I personally, would like to use LuaJIT2 for
numerics in a way I use MATLAB/Octave -- as a rapid fire mathematics
at my finger tips. Great runtime performance is a big bonus but I
would not bet my house on it.

That said, there is one field IMHO where C/Fortran cannot easily
replace LuaJIT -- certain classes of adaptive numerical algorithms.
The fact that functions are first class and can be created out of thin
air at runtime by other functions opens many possibilities for
adaptive numerics (e.g. genetic algorithms...) that are much harder to
do in C/Fortran world. LuaJIT2 appeal  is its ability to trace/compile
these newly generated functions to boost performance. Sometimes it
will work sometimes not. At this point in time it looks as though that
LuaJIT2 is the best tool for the job.