lua-users home
lua-l archive

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


On Jul 6, 2015, at 8:02 AM, Cosmin Apreutesei <cosmin.apreutesei@gmail.com> wrote:

It gets more complicated and slow[1] if you want the tuple table to be self-cleaning though (add in gc/weak-table overhead). I would imagine that a built-in tuple type would be much more efficient since it would just index on the sum of the hashes of the elements and only check the elements on collisions, or am I missing something?


Possibly a bit more GC friendly to use fully-weak tables and store a reference to the last index table in the tuple as well.

You can make the tuples smaller but a bit more complicated by storing everything in the array section — e.g. n goes in [1], entries in 2 through n+1 and index trie links in n+2 through 2n+1.

Mark