lua-users home
lua-l archive

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


That's what I was thinking as well.

I also wasn't aware of the impact of the mutex.

Thanks!

-Kevin

> 
> If the table doesn't already exist, then you almost certainly 
> want to avoid building it since building it and then indexing 
> it is almost certainly more expensive.
> 
> In the case where it already exists, things seem a bit less 
> clear cut though it's basically a question of where to do the 
> table indexing. My guess would be that for the code you 
> wrote, it would be better to do the table indexing in Lua 
> since lua_pushliteral has to find the corresponding Lua 
> string. If you pre-registered the strings -- or registered 
> them on your first pass -- you could avoid that issue.
> 
> Another thing to note is that if you build multi-threading 
> support into Lua, a frighteningly large number of calls 
> involve locking and unlocking the Lua mutex and this can have 
> a measurable impact on performance. (I think I saw a factor 
> of two for stuff that crossed the Lua/C boundary a lot and 
> this was without contention for the mutex).
> 
> Mark