Lua

The LuaJIT Wiki

not logged in | [Login]

Not Yet Implemented

All aspects of Lua are implemented in LuaJIT's interpreter, but not all of them are implemented in LuaJIT's JIT compiler. This page serves as a quick reference to identify whether certain things are implemented or not. Hopefully meaning that you can avoid them in performance-critical code rather than puzzle over why you're seeing poorly performing code and NYI messages from -jv.

Libraries

The following tables list whether or not calls to various library functions will get compiled:

  • yes - Calls to these functions are always JIT-compiled.
  • partial - Depending on the arguments and circumstances, some calls can be JIT-compiled, others will fall back to the interpreter.
  • no - Calls to these functions will not be JIT-compiled, and will always fall back to the interpreter.

Base Library

Function Compiled? Remarks
assert yes
collectgarbage no
dofile no
error no
getfenv no
getmetatable yes
ipairs partial Won't compile if string coercion is invoked.
load no
loadfile no
loadstring no
next no
pairs no
pcall yes
print no
rawequal yes
rawget yes
rawset yes
select partial Only compiled when first argument is a constant.
setfenv no
setmetatable yes
tonumber partial Won't compile for bases other than 10, other exceptions apply.
tostring partial Only compiled for strings, numbers, booleans, nil, and values with a __tostring metamethod.
type yes
unpack no
xpcall yes

String Library

Function Compiled? Remarks
string.byte yes
string.char no
string.dump no
string.find no
string.format no
string.gmatch no
string.gsub no
string.len yes
string.lower no
string.match no
string.rep no
string.reverse no
string.sub yes
string.upper no

Table Library

Function Compiled? Remarks
table.concat no
table.foreach no
table.foreachi no
table.getn yes
table.insert partial Only when pushing.
table.maxn no
table.remove partial Only when popping.
table.sort no

Math Library

Function Compiled? Remarks
math.abs yes
math.acos yes
math.asin yes
math.atan yes
math.atan2 yes
math.ceil yes
math.cos yes
math.cosh yes
math.deg yes
math.exp yes
math.floor yes
math.fmod no
math.frexp no
math.ldexp yes
math.log yes
math.log10 yes
math.max yes
math.min yes
math.modf yes
math.pow yes
math.rad yes
math.random yes
math.randomseed no
math.sin yes
math.sinh yes
math.sqrt yes
math.tan yes
math.tanh yes

IO Library

Function Compiled? Remarks
io.close no
io.flush yes
io.input no
io.lines no
io.open no
io.output no
io.popen no
io.read no
io.tmpfile no
io.type no
io.write yes

Bit Library

Function Compiled? Remarks
bit.arshift yes
bit.band yes
bit.bnot yes
bit.bor yes
bit.bswap yes
bit.bxor yes
bit.lshift yes
bit.rol yes
bit.ror yes
bit.rshift yes
bit.tobit yes
bit.tohex no

FFI Library

Function Compiled? Remarks
ffi.alignof no
ffi.abi yes
ffi.cast partial Same restrictions as ffi.new (as casting is a form of cdata creation).
ffi.cdef no
ffi.copy yes
ffi.errno partial Not when setting a new value.
ffi.fill yes
ffi.gc no
ffi.istype yes
ffi.load no
ffi.metatype no
ffi.new partial Not when the allocation is for more than 64 bytes, other exceptions apply.
ffi.offsetof no
ffi.sizeof no
ffi.string yes
ffi.typeof no

Coroutine Library

No functions are compiled.

OS Library

No functions are compiled.

Package Library

No functions are compiled.

Debug Library

No functions are compiled.

JIT Library

No functions are compiled.