[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT2 performance for number crunching
- From: Francesco Abbate <francesco.bbt@...>
- Date: Sat, 19 Feb 2011 19:24:36 +0100
2011/2/19 Mike Pall <firstname.lastname@example.org>:
> Fixed implementation attached. Much faster.
thank you very much, this is really great. I will have the honour to
have a commit of Mike in my git repository ;-)
Now is the timing:
C code (-O2) with GSL library:
so LuaJIT2 is ~ 2.4x faster then C code. This is quite in line with my
expectations based on previous tests with simple RK algorithm. I would
like to point out that I've made myself some optimizations of the GSL
algorithms, nothing exceptional but it does help to simplify the
algorithm and gain some speed.
For the other side the performance delivered by LuaJIT2 is absolutely
outstanding, we cannot underestimate the technical achievement of Mike
and the impact of its work in all the domains where Lua is used.
Talking again about the fix of Mike on the ODE algorithms, here the
point that I understood about his modification:
- never store a pointer to a ffi structure member in a local like in
local dydt = s.dydt
I remember now that Mike wrote already a recommendation about this practice.
- never perform multiple assignements when the left hand side are
members of a ffi
s.y, s.y = y_0, y_1
Mike wrote that in two separate assignments but it is not clear to
me why this should
Otherwise I have discovered that my first benchmark had a problem, for
some reason when GSL shell is built with the math functions in the
global namespace the JIT does not compile anything at all for the ode
example. I can obtain something correct in GSL shell by enabling
LUA_BUILD in makeconfig, in this case the math functions are in the
'math' namespace and everything works right. Do you have, Mike, some
hints about why this problem arise ? The problem is that I access the
global namespace ? What I can use to troubleshoot this kind of
Well, may be I'm really dumb but '-jv' does not work at all, even with
a vanilla luajit2 build I get:
/src/luajit: unknown luaJIT command
In any case thank you very much for your help.