lua-users home
lua-l archive

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


We're currently evaluating Lua for usage in our next commercial PS2 project.

People have previously talked on the list about issues with Lua's speed on
the PS2, with suggestions about switching Lua to use floats instead of
doubles, and so forth, but nobody seems to have posted any hard
performance numbers.

I've taken the steps recommended for Lua usage on the PS2, and have been
performing memory and CPU profiling.  If anyone else has done similar
testing, I'd be very interested to compare my results against yours.  PS2
performance is, unsurprisingly, my real focus point, but I'd also be
interested to hear about performance on other platforms.


Building Lua into our game makes our executable about 100k larger.  This
means there's 100k less RAM available to the game, even before creating a
virtual machine.  With one virtual machine, the base Lua library, and our
single script loaded (plus bindings), Lua allocates about another 20k of
RAM, for a grand total of about 120k of memory required.  Of course, that
number will grow as the number of scripts increases.

In terms of performance, our natively compiled code executed in the range
of 3-9 microseconds on the PS2, depending on which codepath was taken
through the algorithm.  The Lua script executed in the range of 80-100
microseconds, also depending on which codepath was taken.

So overall, we're finding costs of about 120k of RAM, plus a few more k
per loaded script, and execution times running at about ten to twenty
times that of native code.  Does that sound like the right ballpark?

(I know that it's a rather unfair comparison -- I'm not expecting Lua to
be as fast or as lightweight as native code, I just want to know what the
actual costs are, to weigh them against the conveniences of the scripting,
so that I can make informed decisions regarding whether and how much
scripting to support in our coming game)

- Trevor