lua-users home
lua-l archive

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

> Although even when not jitting, the hand-coded interpreter is going to
> give that extra factor of 2 or 3 times - *if* the platform is
> supported by LuaJIT.

So I would like to see real numbers on this and document under which
circumstances and try to avoid propaganda because bad information can
encourage bad decisions. I recently did some internal benchmarks of
LuaJIT vs. Lua 5.3 work 2 on an iPad mini (1st gen). The iPad
disallows JIT so LuaJIT must go through the interpreted mode. I saw no
speed difference between the two. (I have heard the claims the
hand-coded interpreter still yielded significant benefits, and I'm
disappointed they didn't live up.)

Repeating the same benchmark on a desktop where LuaJIT can use JIT, I
did see the significant speedup of course.

The experiment was a sprite test with SDL bound to Lua (using
traditional compiled techniques, not FFI). So the two common hot paths
were calling into C (to call SDL drawing APIs) and to actually
compute/move the sprites around. I also wrote a pure C version as a
control. Off the top of my head, I think Lua 5.3 was a little shy of
60% of C. LuaJIT with JIT enabled was 75% of C. (I consider this
pretty good because I expected less since most of the code crosses
into C...I was surprised how much LuaJIT could speed up my simple
sprite movement code.)

By the way, I've also been playing with shrinking Lua 5.3's number
types. On the iPad, I've seen a little short of 10% speed up. (I
really like Lua 5.3 and integer subtypes!)

Beginning iPhone Games Development