lua-users home
lua-l archive

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



Is tolua optimized enought to be (very much) used  in
a real time game?

Are there some "performance tips" or "good tolua
programming guidelines" you could share with us?

I believe tolua can perform very fast. It mainly  wastes time
for checking parameter types. However, with tolua 5.0, you
can define the constant TOLUA_RELEASE for compiling the
binding code with no type checking. Of course, you should only
turn off the checking after ensuring the functions/methods are
being called with the correct parameters.

With that, you cannot use overloaded functions, because it
require run-time type checking.

For good performance, you should also avoid returning structs by values
and receiving arrays as parameters (both require dynamic memory allocation).

Finally, the generated binding code is long and it can be a problem for binding large APIs due to large code size; however, it does not impose run-time performance penalty.

Hope it helps.

-- Waldemar