Forum

> > Off Topic > LuaJIT
Forums overviewOff Topic overviewLog in to reply

English LuaJIT

8 replies
To the start Previous 1 Next To the start

old LuaJIT

Dousea
User Off Offline

Quote
When thread news CS2D Beta 0.1.2.6 released, Lua modules was replaced by LuaJIT. I want to know what are the differences between Lua and LuaJIT beside the performance. I Google-d it and found out that LuaJIT runs faster.

old Re: LuaJIT

Marcell
Super User Off Offline

Quote
@user Dousea:

Supports many things.. At least i could connect to MySQL so quickly. So i think it was quite good, but not anymore.

old Re: LuaJIT

Starkkz
Moderator Off Offline

Quote
1. LuaFFI
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).

old Re: LuaJIT

Dousea
User Off Offline

Quote
I don't talk about LuaJIT modules (if those modules aren't included in LuaJIT). I'm talking about LuaJIT can do this while Lua can't, and so on. And I searched over Google about JIT, and JIT is Just-In-Time compilation. Is that right? So LuaJIT is executed at run-time? I really don't know about this.

old Re: LuaJIT

Starkkz
Moderator Off Offline

Quote
@user 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
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
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
14842285 Hz (Zeke.LuaJIT2 in BlitzMax)
6546415 Hz (Pub.Lua in BlitzMax)
5248968 Hz (Counter-Strike 2D)
6630797 Hz (SciTE from Lua for Windows)
I could've been running my computer in economic mode.

old Re: LuaJIT

Dousea
User Off Offline

Quote
So speed is the only difference between Lua and LuaJIT?

old Re: LuaJIT

Starkkz
Moderator Off Offline

Quote
@user 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 user Marcell said, he was able to use MySQL because LuaFFI was necessary for it.

old Re: LuaJIT

DC
Admin Off Offline

Quote
Yes, JIT means "just in time" and it's about compilation of the script.

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.
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview