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.