Page 1 of 2

LuaJIT 2.0

Posted: Sat Oct 31, 2009 11:38 pm
by Star Crunch
This was posted about a half hour ago on the Lua mailing list:
Mike Pall wrote:It's almost midnight on Halloween here. This is the perfect time
to release long-awaited, almost mythical open source software ... ;-)

Yes, here it is: the first public release of LuaJIT 2.0!

Here is a link to the home page:
http://luajit.org/luajit.html

And a direct link to the download page:
http://luajit.org/download.html

What is LuaJIT?
---------------

LuaJIT is a Just-In-Time (JIT) Compiler for Lua. It's fully
compatible with standard Lua 5.1 and can significantly boost the
performance of your Lua programs.

LuaJIT is open source software, released under the MIT/X license.

LuaJIT builds out-of-the-box on all popular x86 operating systems
(Linux, Windows, OSX etc.). It runs fine as a 32 bit application
under x64-based systems, too.

This is a BETA TEST release -- the current status and the list of
known issues are shown here: http://luajit.org/status.html
Please report any problems you may find with this release. Thank you!

What's new in LuaJIT 2.0
------------------------

The VM of LuaJIT 2.0 has been rewritten from the ground up and is
relentlessly optimized for performance. It combines a high-speed
interpreter, written in assembler, with a state-of-the-art JIT compiler.

An innovative trace compiler is integrated with advanced, SSA-based
optimizations and a highly tuned code generation backend. This allows a
substantial reduction of the overhead associated with dynamic language
features. It's destined to break into the performance range
traditionally reserved for offline, static language compilers.

Performance on numerical code is already quite competitive (see below).
Support for other areas (e.g. string functions) is still a bit weak.
Although the VM supports all Lua language features and standard library
functions, the JIT compiler is not complete (yet) and falls back to the
interpreter in some cases. All of this works transparently, so unless
you use -jv, you'll probably never notice. The interpreter is quite
fast, too (near the performance of the LuaJIT 1.x JIT compiler).

Preliminary benchmark numbers are shown below -- performance will
likely improve during the beta test phase. These numbers are mainly
intended to give you an idea about the typical speedups you can expect,
depending on the type of application. Your mileage may vary.

Ok, so thanks to everyone for their patience! A big thank you goes to
the alpha testers. And now, please have fun with it -- Happy Halloween!

--Mike

Relative speedup over Lua 5.1.4 on standard Lua benchmarks
(e.g. 11.9 means it's almost twelve times faster):

md5 152.7 | mandelbrot 13.4 | nsieve 4.7 |
array3d 101.5 | pidigits 12.4 | partialsums 4.1 |
array 73.5 | random 12.2 | chameneos 3.8 |
methcall 28.8 | nsievebits 12.0 | recursive 3.5 |
nsievebits 28.0 | nestedloop 11.9 | knucleotide 3.4 |
matrix 23.0 | lists 9.3 | binarytrees 2.7 |
spectralnorm 21.4 | cheapconcr 5.5 | meteor 2.0 |
fannkuch 20.9 | cheapconcw 5.4 | revcomp 1.8 |
nbody 14.8 | fasta 5.3 | sumfile 1.5 |

SciMark scores on a 3 GHz Core2 E8400 (single-thread, not vectorized),
higher numbers are better:

SciMark composite |
small score | FFT SOR MC SPARSE LU
----------------------------+---------------------------------------
GCC 4.3.2 906.1 | 739.1 909.0 190.4 1057.0 1635.1
JVM 1.6 Server 876.3 | 573.8 1185.5 297.7 579.2 1745.4
JVM 1.6 Client 579.6 | 424.8 895.8 122.8 595.5 859.0
----------------------------+---------------------------------------
LuaJIT 2.0.0-beta1 580.4 | 427.4 1025.0 223.7 303.4 922.5
LuaJIT 1.1.5 96.7 | 72.0 166.1 37.1 91.8 116.5
Lua 5.1.4 16.5 | 11.0 27.4 7.6 16.9 19.5

Get the newest Lua SciMark here: http://luajit.org/download/scimark.lua
Maybe it doesn't matter so much now, but worth a look for 0.7.0. :)

I'm slowly putting together a prototype of something now, so I figure after I migrate
its stuff over to 0.6.0 I'll at least build this into it and experiment.

Re: LuaJIT 2.0

Posted: Sat Oct 31, 2009 11:51 pm
by Fizzadar
Wow, that's brilliant! And I already thought Lua was fast :P

Re: LuaJIT 2.0

Posted: Sun Nov 01, 2009 2:05 am
by subrime
The fine print is quite clear: LuaJIT only works on x86 platforms (because of hand coded assembly).

If this becomes a part of LOVE, it will cut off a significant degree of compatibility...

Re: LuaJIT 2.0

Posted: Sun Nov 01, 2009 2:43 am
by Robin
subrime wrote:If this becomes a part of LOVE, it will cut off a significant degree of compatibility...
The only way this could get into LÖVE then would be as something "optional", I guess.

Re: LuaJIT 2.0

Posted: Sun Nov 01, 2009 8:50 am
by subrime
As far as love goes, it seems almost pointless.

Most of the time game speed is limited by the graphics, sound and physics - all of which are provided by precompiled external libraries (SDL, OpenAL, Box2d). LuaJIT gives no benefit at all to this situation.

For the tiny fraction of lua implemented game logic that might benefit from LuaJIT, there is already a way to speed it up with the new love.native facility.

Re: LuaJIT 2.0

Posted: Sun Nov 01, 2009 9:58 am
by bartbes
subrime wrote:with the new love.native facility.
Well, that has been removed because of lack of portability too..

Re: LuaJIT 2.0

Posted: Sun Nov 01, 2009 10:05 am
by daveberk
subrime wrote:The fine print is quite clear: LuaJIT only works on x86 platforms (because of hand coded assembly)
As of right now. But he does plan to port this to x64. He's currently looking for a sponsor, let's hope some large game company sponsor him...

Anyway, what's Love needs more than speed improvement right now, IMHO, is utf8 support.

Re: LuaJIT 2.0

Posted: Sun Nov 01, 2009 4:40 pm
by Sardtok
daveberk wrote:
subrime wrote:Anyway, what's Love needs more than speed improvement right now, IMHO, is utf8 support.
Do you mean supporting real-time rendering of any unicode glyph? Cause that's been discussed before, and it's not going to happen (at least not any time soon).
If you just need certain glyphs, you could use a bitmap font.

Re: LuaJIT 2.0

Posted: Sun Nov 01, 2009 9:20 pm
by subrime
daveberk:
There are a host of other hardware architectures that would be nuked by this (PPC32, PPC64, ARM, etc) - nothing kills portability like hand coded assembly...

But the main point stands: the biggest load in most games is already taken by external libraries that would get no benefit from LuaJIT.

Re: LuaJIT 2.0

Posted: Tue Nov 03, 2009 3:18 pm
by SuperRad
subrime wrote:daveberk:
There are a host of other hardware architectures that would be nuked by this (PPC32, PPC64, ARM, etc) - nothing kills portability like hand coded assembly...

But the main point stands: the biggest load in most games is already taken by external libraries that would get no benefit from LuaJIT.
Don't the majority of non-x86 platforms have quite poor OpenGL hardware support (ie lacking drivers), which will cause Love to crawl during rendering anyhow though?