LuaJit

Has anyone looked into using http://luajit.org/ in place of Lua ?

1 Like

Somebody had told me that, and asked me to replace the current version.
I have not time to do it. What’s your opinion?

luajit game cannot put on the official app store because hit generate code in runtime.

luajit game cannot put on the official app store because jit generate code in runtime.

I’ve not got the knowledge of experience to comment effectively, but as I understand it, the luaJit interpreter will be fine (and shows a performance improvment over the standard lua library) vs. the luaJit compiler which generates code at runtime. Even that may be ok, but no one has submitted an app to find out :wink:

My knowledge from(http://luajit.org/install.html)

Note: the JIT compiler is disabled for iOS, because regular iOS Apps are not allowed to generate code at runtime. You’ll only get the performance of the LuaJIT interpreter on iOS. This is still faster than plain Lua, but much slower than the JIT compiler. Please complain to Apple, not me. Or use Android. :-p

So, we can not use it.
Because we should keep all platforms the same.
Somebody wo want to use only on Android can have a try.

Well the platforms are different, inevitably, the code will run at different speeds on both platform, would it not be better to try and squeeze the maximum performance we can out of both. We could (if you wished) I guess cripple the android platform in the same way (i.e. disable the compiler and only use the updated interpreter)

How to use? Just replace the lua codes or should do more configurations?

My (limited) understanding is that it is a drop-in replacement for the normal lua libs. however I struggled to get it building on my mac (I think it doesn’t work with gcc-llvm and needs to use gcc-4.2) but I stopped looking until I knew whether it was worth continuing to look at :slight_smile:

I have successfully compiled luajit2.0.0 for IOS version,please see http://blog.csdn.net/dragoncheng/article/details/8155079.
The running speed improved significantly。

Hi,every body, I used cocos2d-x integration with luajit, on platform window, its performance improve is so clear, but on platform android. It assume the same with normal lua vm, did anyone kown why?

I have experience using Lua and LuaJIT.

Lua has a VM and bytecode interpreter. It is designed to be simple and clean and portable, and is quite decent and fast.

LuaJIT has its own VM and bytecode format, which is different. The bytecode is smaller and more portable. The VM is faster. This is all without JIT.

LuaJIT also has JIT, but that needn’t be used (and indeed cannot be used on most mobile devices).

Once you have built LuaJIT, using it is as simple as linking to its libraries instead of Lua’s. Because they are binary compatible, it’s a drop in replacement.

Good luck.