Page 1 of 1

luajit - large lua performance improvement

Posted: 28 Jul 2015, 06:04
by ahundt
luajit is a drop in shared library replacement for lua that runs between 2-50x faster than standard lua according to the developers.

If that is the case the only changes should be compiling v-rep with the luajit headers included instead of the lua headers, and including the luajit dll/dylib/so with vrep instead of the regular lua one.

I think luajit could be a very easy to add and useful improvement to V-REP.

Re: luajit - large lua performance improvement

Posted: 14 Aug 2015, 20:09
by ahundt
I've been hoping to do more of my work in lua where it makes sense, so I investigated matrix/linear algebra libraries for lua. Unfortunately, nearly every example I could find uses luajit and very few are implemented in pure lua or with the standard lua interpreter.

Here is a selection of luajit based lua libraries:
SciLua - http://scilua.org
LuaPower - https://luapower.com/
Lua-Eigen - https://github.com/devurandom/lua-eigen (defunct)

pure lua:
Lua-Matrix https://github.com/davidm/lua-matrix (defunct)

My understanding is that this makes it incompatible with V-REP because V-REP uses the interpreter provided at lua.org.

I think this may be an additional compelling reason to consider luaJIT for the core scripting language of V-REP.

Re: luajit - large lua performance improvement

Posted: 17 Aug 2015, 08:25
by coppelia
Hello,

after the next release (3.2.2) we will take a closer look at Luajit. Until now this was not considered since most of the time (or at least for most users) Lua is not the bottleneck.

Cheers

Re: luajit - large lua performance improvement

Posted: 07 Sep 2015, 18:21
by coppelia
In release 3.2.2, we have centralized the Lua API accesses, and optionally you can request V-REP to use a library to interact with the Lua library. In file system/usrset, set the variable useExternalLuaLibrary to true. If you do so, all Lua calls will transit via the v_repLua.dll library (or libv_repLua.so or 6), which will link to the LuaJIT library by default (but you can recompile that v_repLua library yourself for specific things (the project files are located in programming/v_repLuaLibrary)). The LuaJIT works fine on Windows and Linux, on Mac there seems to be a problem and we didn't have the time to put our finger onto it yet.

Cheers

Re: luajit - large lua performance improvement

Posted: 25 Sep 2015, 19:45
by ahundt
You guys are amazing. I use mac myself but I will try it once you've been able to resolve those problems!