Page 1 of 4

LoveJIT

Posted: Sat May 28, 2011 5:28 am
by slime
I compiled LÖVE 0.7.2 for Mac and Windows using the latest (2.0.0-beta7) LuaJIT build. I don't have access to a Linux distro so I didn't make a Linux version.


Downloads

Intel-based Macs

Windows


There is no PowerPC version of LuaJIT for OS X, unfortunately. The windows version needs the new "Lua51.dll" file because LuaJIT for Windows needed to be compiled dynamically rather than statically.


Here's a couple example screenshots of LÖVE using this implementation of simplex noise for Lua (it utilizes LuaJIT's FFI):

Image

Image

It takes about 0.13 seconds for me to map a 512x512 pixel imagedata using simplex2d values and LuaJIT.

Re: LoveJIT

Posted: Sat May 28, 2011 6:06 am
by Ensayia
Can we get a few time comparisons on different size images created with imagedata? I would really like to see a chart of JUT versus non JIT.

This is actually very interesting, good work.

EDIT: Nevermind, I ran a little performance myself using this code, where I insert 30 million random numbers into a table:

Code: Select all

function love.load()
	numbers = {}
	math.randomseed(os.time())
	done = false
	t1 = love.timer.getMicroTime( )
end

function love.update()
	if not done then
		for i = 1, 30000000 do
			numbers[i] = math.random()
		end
		t2 = love.timer.getMicroTime()
		done = true
	end
end

function love.draw()
	if done then
		love.graphics.print("All Done!", 10, 10)
		love.graphics.print("Time Taken: "..t2-t1, 10, 30)
	end
end
Plain LOVE takes 8.31640625 seconds to complete the table.
LuaJIT LOVE takes 1.80859375 seconds to complete the table.

:ultrashocked:

I have to say I heard using JIT was faster, but that is insane...

Re: LoveJIT

Posted: Sat May 28, 2011 8:06 am
by BlackBulletIV
Ensayia wrote:Plain LOVE takes 8.31640625 seconds to complete the table.
LuaJIT LOVE takes 1.80859375 seconds to complete the table.
Wow, that's pretty awesome!

Re: LoveJIT

Posted: Sat May 28, 2011 11:44 am
by NÖÖB
Ooooo is that noise generated on the fly at 471fps?
Ensayia's code took 2 seconds with JIT, 14 seconds without..

Missing msvcr100.dll btw, can that be statically linked?

Re: LoveJIT

Posted: Sat May 28, 2011 2:54 pm
by slime
I updated the windows zip so you (hopefully) won't need msvcr100.dll anymore.
The noise isn't generated at 471fps, that's just me drawing 2 512x512 images with a shitty video card. :P

LuaJIT's performance really shows when doing some heavy calculations in pure Lua code, for example this dynamic light demo runs at ~140fps without regular Lua and ~440fps with LuaJIT (and 300 vs 850 on my better video card). Things that are more graphically bound (example: drawing 100 different images in immediate mode) or crossing the Lua/C++ border a lot won't make much of a difference with LuaJIT vs regular Lua.

Re: LoveJIT

Posted: Sat May 28, 2011 5:58 pm
by sentry
Thank you for compiling love with LuaJIT.

My game desperately needed some JIT love.

Re: LoveJIT

Posted: Sat May 28, 2011 6:46 pm
by ishkabible
nice, now i have an updated version of Love with LuaJIT ;) thanks!!

edit:
dose this have FFI by chance?

edit2:
yes it dose!!! now im going to see if i can do something with this :)

Re: LoveJIT

Posted: Sun May 29, 2011 7:35 am
by Chief
This is to awesome to be true!

Aren't there any downsides?

Re: LoveJIT

Posted: Sun May 29, 2011 10:09 am
by Robin
Chief wrote:Aren't there any downsides?
No, you only need to sell your soul. I wasn't using mine anyway. ;)

Re: LoveJIT

Posted: Sun May 29, 2011 10:34 am
by Boolsheet
Chief wrote:Aren't there any downsides?
Because it's still in development there's always the probability of hard-to-track bugs. I once found one that ignored the first value in the table constructor in a very specific condition.

On x86 systems without SSE2 it falls back to the interpreter.
And it's targeting specific architectures and (generic?) PPC is not one of them.