lua-users home
lua-l archive

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


On 5 November 2015 at 12:09, Rena <hyperhacker@gmail.com> wrote:
>> Another thing that may help is if there was a way to make a table
>> fixed in keys - i.e. notify that no further key updates are possible.
>> This could be used by the table library to optimize the hash table so
>> that all keys require only single access. I understood you are looking
>> at this for another reason ... optimization of length operations - but
>> there is probably also a benefit in scenarios such as here.
>>
>> Regards
>>
> Would it be enough to provide a "hint" function, that tells the interpreter
> "I probably won't be modifying this table['s keys] anymore, so if you could
> take a moment to do whatever you need to make reading from it as fast as
> possible, that'd be great"? Understanding that if you do modify the table
> afterward, it might be slow, and that the function might do nothing at all
> in some implementations.

Hi,

I was thinking more of a library function to make a table's keys
fixed. When this is called the table library could optimize the hash
table by resizing it so that there are minimum or no collisions. It
would be fine if there was a function to undo this.

Regards