[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: Lua strings as "atoms"???
- From: "Joshua Jensen" <jjensen@...>
- Date: Tue, 17 May 2005 08:36:28 -0600
> That's a good idea. But why is the registry less efficient?
> Can't you store a string in the registry and get back a
> numeric id that can be handed back to the registry to get
> pushed just as fast as an upvalue? Or is there some
> optimization in upvalues that make them faster?
In LuaPlus, this is done very efficiently and looks like this:
string2 = state->GetGlobal("SomeEntryThatEqualsHello");
if (string1 == string2)
LuaObjects can persist as globals variables, so I frequently optimize by
grabbing as many of the known strings in advance and using them to index
Interestingly, LuaRC is missing an API for it, but it would easily support
incrementing the reference count on the object and holding onto it that