Questions tagged [luajit]

LuaJIT is a Just-In-Time Compiler for the Lua programming language. LuaJIT offers more performance, at the expense of portability. On the supported OS's (all popular operating systems based on x86 or x64 CPUs (Windows, Mac OSX, Linux, ...), ARM based embedded devices (Android, iOS) and PPC/e500v2 CPUs) it offers an API- and ABI-compatible drop-in replacement for the standard Lua interpreter.

Overview

LuaJIT is a high-performance, Just-In-Time(JIT) implementation by Mike Pall for the Lua programming language. It has been successfully used as a scripting middleware in games, 3D modelers, numerical simulations, trading platforms and many other specialty applications. It combines high flexibility with high performance and an unmatched low memory footprint: less than 125K for the virtual machine(VM) plus less than 85K for the JIT compiler (on x86).

LuaJIT has been in continuous development since 2005. It's widely considered to be one of the fastest dynamic language implementations. It has outperformed other dynamic languages on many cross-language benchmarks since its first release — often by a substantial margin. In 2009 other dynamic language VMs started to catch up with the performance of LuaJIT 1.x. Well, I couldn't let that slide. ;-)

2009 also marks the first release of the long-awaited LuaJIT 2.0. The whole VM has been rewritten from the ground up and relentlessly optimized for performance. It combines a high-speed interpreter, written in assembler, with a state-of-the-art JIT compiler. An innovative trace compiler is integrated with advanced, SSA-based optimizations and a highly tuned code generation backend. This allows a substantial reduction of the overhead associated with dynamic language features.

It's destined to break into the performance range traditionally reserved for offline, static language compilers.

Compatibility

LuaJIT implements the full set of language features defined by Lua 5.1. The virtual machine is API- and ABI-compatible to the standard Lua interpreter and can be deployed as a drop-in replacement.

LuaJIT offers more performance, at the expense of portability. It currently runs on all popular operating systems based on x86 or x64 CPUs (Linux, Windows, OSX etc.) or embedded systems based on ARM (Android, iOS) or PPC/e500v2 CPUs. Other platforms will be supported in the future, based on user demand and sponsoring.

388 questions
0
votes
2 answers

How to implement lua_lock/lua_unlock in luajit?

I am reading this lua thread tutorial and my lua code may be accessed by other threads at anytime and all I wan to do is to protect the luaState from corrupting. I just searched luajit's source but found there is no lua_lock/lua_unlock in place. So…
Mickey Shine
  • 11,559
  • 22
  • 84
  • 142
0
votes
2 answers

Error when compiling with luajit and lua-iup libs [visual c++ 2012]

I wrote an app with luajit and lua-iup, and link my app with static libs. But I got the following error: ------ Build started: Project: ConsoleApplication1, Configuration: Release Win32 ------ Creating library C:\Users\root\Documents\Visual…
Mickey Shine
  • 11,559
  • 22
  • 84
  • 142
0
votes
1 answer

LuaJIT Vector Library

I am using LuaJIT with OpenGL ES 2.0 as a way to rapidly create some 3D interactive scenes. I have been busy reinventing the wheel, making my own vector library. My question is, does anyone else have experience with this sort of thing? Are there…
chowey
  • 7,470
  • 4
  • 46
  • 72
0
votes
1 answer

Argv functions vs. LuaJIT FFI's vararg

Is there a more effecient way to handle argv functions than this? ffi.cdef [[ void fooArgv(int argc, const char ** argv, const size_t * argvlen); ]] local foo = function(...) local nargs = select("#", ...) local argv = { } local argvlen =…
Alexander Gladysh
  • 34,198
  • 31
  • 94
  • 153
0
votes
1 answer

Combine wxLua with LuaJIT on Mac OS X

How do you build wxLua on Mac OS X (10.6.8) so that it uses LuaJIT2 instead of the standard Lua interpreter? I have tried: ./configure --with-lua-prefix=/Users/finnw/LuaJIT-2.0.0-beta9 where /Users/finnw/LuaJIT-2.0.0-beta9 is the directory in which…
finnw
  • 45,253
  • 22
  • 134
  • 212
-1
votes
1 answer

Passing shared_ptr to Lua

Some time ago I have decided to go for a reference count methodology to manage the lifetime of the resource and it did a trick. Later I have faced a new challenge, to preserve an object lifetime till Lua executes a long-running task in a separate…
teoring
  • 85
  • 12
-1
votes
1 answer

LuaJIT build failed with NDK, CentOS

I tried to build LuaJIT with Android NDK as the official guide. But some problems happened. I have search for 2 days but can't solve them. Here's my…
Chenhe
  • 689
  • 7
  • 17
-1
votes
1 answer

Printing tensor containing more than 10 columns in Luajit/ torch

I want to print a tensor of dimension 2 X 11 in console. print(tensor) is printing like this Columns 1 to 10 0.2660 0.1791 0.1237 0.0558 0.0810 0.0284 0.0103 0.1185 0.0811 0.0258 0.1408 0.2460 0.1186 0.0831 0.1497 0.0297 0.0094 …
-1
votes
1 answer

Lua multithreading module

I'm looking for multithreading support for Lua/LuaJit. I found http://lua-users.org/wiki/MultiTasking a lot of varians of modules, but I can't find up-to-date module. Can somebody provide me the most useful Lua-threading? It is hardly difficult to…
Vyacheslav
  • 23,112
  • 16
  • 96
  • 174
-1
votes
1 answer

LuaJIT FFI cdef doesn't understand 'class'?

class Myuser * MyClient_GetMyUser(AUser aUser); This is the error for trying to declare that function with ffi.cdef: Error: dllImport.lua:861: declaration specifier expected near 'class' at line 20 How is this possible? How would I go about…
theman
  • 345
  • 1
  • 10
-1
votes
1 answer

deepcopying function variable gives unexpected results

I have an object that I create using the following function local function newObject(functionVariable) ... functionVariable = functionVariable or nop ... return setmetatable({ ... functionVariable =…
theman
  • 345
  • 1
  • 10
-2
votes
1 answer

Slow FFI.cast in luajit

Could you please explain low performance of FFI.cast in a following snippet? prof = require 'profile' local ffi = require("ffi") ffi.cdef[[ struct message { int field_a; }; ]] function cast_test1() bytes = ffi.new("char[100000000]") …
Dmitry Vyal
  • 2,118
  • 1
  • 23
  • 24
-3
votes
1 answer

luajit '=' expected near '-'

I have been trying to use luajit to compile luas, which is not relevant right now. However, when I try to enter luajit -h (which should usually list commands) into the cmd looking luajit.exe window, I get the error " '=' expected near '-' ". I have…
1 2 3
25
26