lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Robert G. Jakabosky wrote:
> I converted the Lua bytecode dispatch loop code into a set of C functions one 
> for each opcode.

Interesting approach. Quite similar to what LuaJIT 1.x does,
except it concatenates machine code snippets directly.

> The first time I ran the 
> meteor.lua script it used more then 30 seconds to codegen all the Lua code, 
> where as the normal Lua vm took less then 4 seconds to run the whole script.  

The generated source from meteor.lua weighs in at 5600 lines with
plenty of conditionals. Parse time (Lua -> bytecode) is 13ms,
compile time (bytecode -> machine code) for LuaJIT 1.1 is 25ms
(compare to the 30s for LLVM). Is this due to suboptimal use of
LLVM or does it really mean LLVM as a JIT compiler is 1200x
slower? *ick*

> See the attached benchmark.log comparing the normal Lua vm with llvm-lua, 
> native, and luajit.

I think you'd get a more meaningful comparison if you'd run LuaJIT
with "luajit -O". Running all of the scripts in sequence within
the same Lua state will distort the results since some tests turn
off the GC or the JIT compiler and all subsequent tests will
suffer.

You haven't stated how Lua was compiled (for my comparisons I use
-O3 -fomit-frame-pointer for all sources). It's usually easier to
compare performance by taking a baseline (the standard Lua VM) and
giving the speedup relative to that baseline (e.g. 2.00 = takes
half the time). And summing up the times of all benchmarks is not
a useful metric at all.

Some of the benchmarks seem to be not the best/latest version
(e.g. pidigits) or are missing in the comparison (mandelbrot?).
Many of the older benchmarks are obsolete and contain rather
untuned Lua code. This doesn't matter as long as one only compares
between Lua VMs. But the moment someone gets his hands on these
and compares them to other languages ...

BTW: Latest SciMark for Lua is here:
  http://luajit.org/download/scimark-2008-01-22.lua

--Mike