Forum
LuaJIT
LuaJIT
8 replies
1

Dousea: Supports many things.. At least i could connect to MySQL so quickly. So i think it was quite good, but not anymore.
2. Bit operators
The FFI module and the JIT feature are the main reason of why this language turns into a tier 2 scripting language (low-level).
Dousea: I haven't looked too much into this but I just did a speed test if you wish to know the performance difference.1
2
2
LuaJIT 2.0.4: 24056450 Hz (24 GHz) Lua 5.1: 11443393 Hz (11.4 GHz)
This is the code I used.
1
2
3
4
5
6
2
3
4
5
6
local i = 0
local s = os.clock()
while os.clock() - s <= 1 do
	i = i + 1
end
print("Speed: "..i.." Hz")
I don't really get those results, it's twice the speed. The first results I ever had and sent to DC were those:
1
2
3
4
2
3
4
14842285 Hz (Zeke.LuaJIT2 in BlitzMax) 6546415 Hz (Pub.Lua in BlitzMax) 5248968 Hz (Counter-Strike 2D) 6630797 Hz (SciTE from Lua for Windows)
Dousea: Plus it's modules, they actually are integrated into LuaJIT's source code by default, I'd say they're the most important thing and the reason of why they allow you to use a huge set of libraries from LuaPower's site. Like
Marcell said, he was able to use MySQL because LuaFFI was necessary for it. In normal Lua the scripts are parsed at runtime which makes it slower.
With Lua JIT however the scripts are compiled to bytecode when you load them (this also happens at runtime but before actually running the scripts - so: just in time). Executing bytecode is much faster than parsing strings so this is why Lua JIT is significantly faster.
1

Offline