lua-users home
lua-l archive

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



On Jul 6, 2016, at 12:09 PM, Soni L. <fakedme@gmail.com> wrote:


Without bloating the table type too much. It's better to add this to the table library instead of adding it to the table type. It'll also be easier to handle on the C side of things as you won't have to redesign the whole Lua VM for a completely redesigned table type.

Actually, if the whole Lua VM were to be redesigned, it'd stop being Lua 5.x, instead becoming Lua 6.x. And it'd be slower and heavier, because then you'd track size for all tables, not just the tables that need it.


As I pointed out previously, the overhead is a single 64-bit integer per table. Although this might imply an 8 byte overhead, in fact this is free on all major platforms that I know of (Windows, Linux, iOS, Android) since the granularity of heap allocation means that there is no additional memory allocation at all. So there is no overhead at all, apart from setting a C integer to zero when a table is allocated. Nor is there overhead when adding/deleting table keys (even integer keys).

Why do you think a VM redesign is necessary ?

—Tim