[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Possible enhancements for Lua 5.2
- From: Andre Leiradella <andre@...>
- Date: Sun, 26 Jun 2011 21:57:53 -0300
On 26/06/2011 21:27, GrayFace wrote:
If you're suggesting using a Lua table, there's the lookup cost
associated with retrieving the switch index. If you're suggesting using
a hashtable other than Lua's, there's the cost if computing the hash
*and* the lookup cost.
On 26.06.2011 8:35, Andre Leiradella wrote:
When writing bindings I usually get the key string in
__index/__newindex metamethods and compute some hash with them which
then I use in a switch. It would be nice if I could save the time
spent in computing this hash since Lua already has one.
How about a table to map needed keys to switch indexes?
Like I said before, I already have a solution that is computing a hash
of the string and using it in the switch. What I'm looking for is
someway to use a hash that's already computed and save some cycles from
my binding code.