LoveJIT

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

LoveJIT

Post 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.
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Re: LoveJIT

Post 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...
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: LoveJIT

Post 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!
User avatar
NÖÖB
Prole
Posts: 41
Joined: Thu Jul 31, 2008 10:57 pm
Location: Norway

Re: LoveJIT

Post 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?
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: LoveJIT

Post 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.
User avatar
sentry
Prole
Posts: 8
Joined: Tue Mar 08, 2011 12:00 am
Location: Amsterdam

Re: LoveJIT

Post by sentry »

Thank you for compiling love with LuaJIT.

My game desperately needed some JIT love.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: LoveJIT

Post 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 :)
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Re: LoveJIT

Post by Chief »

This is to awesome to be true!

Aren't there any downsides?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LoveJIT

Post by Robin »

Chief wrote:Aren't there any downsides?
No, you only need to sell your soul. I wasn't using mine anyway. ;)
Help us help you: attach a .love.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: LoveJIT

Post 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.
Shallow indentations.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 61 guests