[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT performance
- From: Mike Pall <mikelu-0908@...>
- Date: Fri, 7 Aug 2009 17:23:39 +0200
John C. Turnbull wrote:
> I am in the early stages of deciding on a fast scripting language for a new
> C++ project and obviously Lua is a candidate. When I say fast I mean fast
> so we'd probably be using LuaJIT as opposed to interpreted Lua.
You should also consider the size of scripting engine you're
embedding and how easy it is to bind to it. Lua and LuaJIT are
more than ten times smaller than V8 and IMHO much easier to embed.
> Does anyone know a performance comparison of JIT'ed Lua versus something
> like V8 JavaScript?
Well, we can find out ... so I fetched today's V8 trunk and ran
some standard benchmarks. Unfortunately the V8 standalone shell is
very limited and is unable to run quite a few of them. And there's
no JavaScript translation for some others. :-(
All ratios are normalized relative to the performance of the
standard Lua interpreter. E.g. 5.0 means something is five times
faster than Lua. Higher numbers are better:
| Lua | V8* | LJ1 | LJ2 | GCC
-------------+------+------+-------------+------
mandelbrot | 1.0 | 0.9 | 5.8 | 12.6 | 15.4
fasta | 1.0 | 1.1 | 2.8 | 4.0 | 13.3
partialsums | 1.0 | 1.4 | 3.8 | 4.2 | 2.2
spectralnorm | 1.0 | 2.9 | 3.1 | 19.8 | 18.5
nbody | 1.0 | 3.0 | 5.0 | 15.3 | 33.0
nsieve | 1.0 | 4.1 | 2.2 | 4.7 | 27.3
nsievebits | 1.0 | 5.7 | 5.2 | 31.6 | 56.0
recursive | 1.0 | 6.8 | 6.3 | 3.0~| 33.1
fannkuch | 1.0 | 6.8 | 7.3 | 21.4 | 34.6
binarytrees | 1.0 | 8.1 | 1.6 | 3.0~| 11.0
All measurements made on a Core2 E8400, comparing single-threaded,
non-hand-vectorized benchmark versions only.
Lua = Lua 5.1.4
V8 = V8 trunk 2009-08-07 IA32 (* sorted by this column)
LJ1 = LuaJIT 1.1.5 -O
LJ2 = LuaJIT 2.0 (unreleased, preliminary numbers, ~ = not JIT compiled (yet))
GCC = GCC 4.3.3 -m32 -O2 -fomit-frame-pointer (or -O3 where it's faster)
Summary: Ok, so V8 is catching up. But LuaJIT 1.x still beats it
on 6 out of 10 benchmarks. V8 is mainly faster on object allocation.
But, surprisingly, V8 is slower for nbody, even though its complex
logic for managing object shapes should make this go really fast.
Not suprisingly, Lua and LuaJIT still have the lead on numeric
benchmarks (unboxed floating point numbers pay off here). And
LuaJIT 2.x will completely change the game (sorry, still no ETA).
But as others have said: please compare the different VMs with
benchmarks that best match *your* performance needs.
--Mike