lua-users home
lua-l archive

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

On 21/10/2011 9.50, Xavier Wang wrote:
OK, Just a question: Is crossing Lua/C bother fast in this situation:
All C functions Lua called and all Lua functions C called are only
have a few of arguments, of number, string and userdata. not else.

I've not used much the Lua/C interface in recent times and, as I said, I had no need to optimize cross-language calls in that case, so I am not in the position to give a reliable answer and I prefer not to guess. It also depends on how your interface calls are made and it may depend on your system.

Do you have some profile data?

No (see above). Anyway, your situation seems to be very different from the one I described, so they probably would not apply.

Sorry for I don't have idea to profile my project --
it's in a big C++ nut-shell :-(

Well, just strategically inserting logging calls would probably give you a lot of information. For example, get the timestamp before and after a loop repeating a single Lua/C call a large number of times (subtract empty loop time); try this with a do-nothing C function, with one of your actual functions, with a different number/type of arguments, etc.
You can't optimize if you don't measure.