[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: void* in Lua_State for Application?
- From: Miles Bader <miles@...>
- Date: Tue, 10 Sep 2013 09:20:02 +0900
Roberto Ierusalimschy <firstname.lastname@example.org> writes:
> Thanks for the info. How did you use the registry? Integer
> keys/lua_rawgeti? String keys? (This message is for Miles Bader,
I just used registry string entries at first because that's what the
various luaL_ functions make easy to use ... luaL_checkudata, etc.
Many existing libraries do things that way, so it was the natural way
But later when trying to optimize things, I tried upvalues instead,
and they were significantly faster.
It never occurred to me to try integer keys (or rawgeti), but as that
presents additional issues (e.g., one must come up with a system to
assign small-integer keys without conflicts), and has no particular
library support (luaL_checkudata etc), it seems like I may as well
just use upvalues when possible (and upvalues of course have the
advantage of being a local namespace, with no namespace conflict
[I will keep those techniques in mind for cases where I can't use
"I distrust a research person who is always obviously busy on a task."
--Robert Frosch, VP, GM Research