lua-users home
lua-l archive

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


On Mon, 07 Jun 2010 04:53:55 +0300, Javier Guerra Giraldez <javier@guerrag.com> wrote:

On Sun, Jun 6, 2010 at 8:13 PM, T T <t34www@googlemail.com> wrote:
Which makes me wonder why #t is not specified in such a way to be
usefull for tables with holes too.

can you suggest such a definition that also:

- is useful for tables without holes

- is quick to compute

- has none or minimal memory requirements.

- has none or minimal overhead on field assignment

The "#t is integer index of first nil", implemented using linked list
of free array nodes, and using binary probing to link in nil node
when setting node to nil would do about 50 000 000 probes in the
worst case, when setting 1000 000 element array to nils.
I don't know if that qualifies as a "minimal" overhead.