lua-users home
lua-l archive

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

On Sat, May 30, 2015 at 11:28 PM, Brigham Toskin
<> wrote:
> Does anyone know the rationale for not just automatically tracking the
> number of entries in a table?

reliably tracking table size means at some point you need a linear
scan.  Yes, i know at first sight it looks like it's just a +1 or -1
(or neither) on each table setting, but there's always some
not-uncommon case where you have to do a potentially-too-heavy

Table setting operations are too critical for _all_ Lua code to be
subject to that kind of overhead.  Having a logarithmic (and
frequently resolved at the first step) operation at visible points of
your code seems a better compromise.