lua-users home
lua-l archive

Re: report on the Lua in the Gaming Industry Roundtable at GDC 2004

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


On 16 Apr 2004, at 17:15, Mark Hamburg wrote:
on 4/16/04 6:22 AM, Edgar Toernig at froese@gmx.de wrote:
The C<->Lua transition is normally cheap. Not very different from a
function call within Lua. But what *could* be expensive is lua_pcall.
The problem with lua_pcall is that it uses setjmp/longjmp which
performs a system call on some systems (those which preserve signal
masks). You could either try _setjmp/_longjmp instead or use lua_call
and catch errors elsewhere (may become difficult with C++).
Additionally, lua_call instead of lua_pcall would remove stack frames
5, 6, and 7 from the above trace.
You could also revise luaD_rawrunprotected and luaD_throw to use C++
exceptions. (Covered previously on this list.) Then Lunar wouldn't need to use pcall to catch any errors since they would be reported just like other
C++ errors.
Mark
P.S. lua_lock and lua_unlock for multithreaded execution become a noticeable
issue in Lua/C and C/Lua transitions.
Thanks to both of you for your suggestions, which I'll both try out -- currently Lua is always run from a single thread in my application, so I leave lua_lock/unlock empty by default.
Ciao,
Dario

AltStyle によって変換されたページ (->オリジナル) /