luajit - large lua performance improvement

Requests or suggestions for new features
Post Reply
ahundt
Posts: 112
Joined: 29 Jan 2015, 04:21

luajit - large lua performance improvement

Post 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.

ahundt
Posts: 112
Joined: 29 Jan 2015, 04:21

Re: luajit - large lua performance improvement

Post 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.

coppelia
Site Admin
Posts: 10558
Joined: 14 Dec 2012, 00:25

Re: luajit - large lua performance improvement

Post 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

coppelia
Site Admin
Posts: 10558
Joined: 14 Dec 2012, 00:25

Re: luajit - large lua performance improvement

Post 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

ahundt
Posts: 112
Joined: 29 Jan 2015, 04:21

Re: luajit - large lua performance improvement

Post by ahundt »

You guys are amazing. I use mac myself but I will try it once you've been able to resolve those problems!

Post Reply