[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: getn
- From: Luiz Henrique de Figueiredo <lhf@<a href="/cgi-bin/echo.cgi?tecgraf.puc-rio.br">...</a>>
- Date: Wed, 27 Feb 2002 15:16:57 -0300
>Lua already has this information readily available. Why not expose it?
Lua does not have this information readily available. It only has the size of
the hash table, which is unrelated to the number of non-nil entries in it.
>This seems incredibly useful, and would be a boon for
>performance for people that need to know these sorts of things without
>iterating over all table elements all the time (or having to modify
>tables they don't own to cache it).
A simple solution, which has come up in the lengthy discussion about getn in
the past, is to use a separate table to cache this info. You'd use your tables
to index this table and store n in it.