lua-users home
lua-l archive

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

On 16 Apr 2004, at 1:12, Ashwin Hirschi wrote:

I think another reason might be that a Lua-C/C++-Lua transition is relatively expensive. So reducing the number of Lua calls to a C++/C engine, like your calling everything in one go approach, will be cheaper. Though I'm not sure exactly how big the savings are in real-world examples...

I have a gdb window open right now, and here's what I see:

0. my C++ code				[breakpoint here]
1. Lunar<myclass>::thunk
2. luaD_precall
3. luaV_execute
4. luaD_call
5. f_call
6. luaD_rawrunprotected
7. luaD_pcall
8. lua_pcall
9. Lunar<myclass>::call

The Lunar calls represent the price I pay for using this particular interface, and I'm fine with that. On the other hand, the seven stack frames required in any case to reach my own code look quite expensive indeed. Obviously I'm not claiming that I could make it in any way faster -- I'm just saying that I completely understand the need for grouping multiple Lua invocations in a single one, and I'll try to implement said mechanism.