lua-users home
lua-l archive

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

2011/2/19 Mike Pall <>:
> Fixed implementation attached. Much faster.

Hi Mark,

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:
real	0m0.439s
user	0m0.436s
sys	0m0.000s

C code (-O2) with GSL library:
real	0m1.041s
user	0m1.028s
sys	0m0.008s

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
  structure like:
  s.y[0], s.y[1] = y_0, y_1
  Mike wrote that in two separate assignments but it is not clear to
me why this should
  change anything.

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
problems ?

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.

Best regards,