lua-users home
lua-l archive

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


On 14/08/2014 8.16, Dirk Laurie wrote:
In actual applications, finding #tbl is quite often followed shortly
by traversing tbl from 1 to #tbl soon afterwards. E.g.
    for i=1.#tbl do ...

I.e. the O(log n) length operator becomes insignificant in comparison
to the O(n) table traversal.

A common case where this does not happen is when appending data:
  t[#t + 1] = v

--
  Enrico