lua-users home
lua-l archive

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


Op Sat, 15 Dec 2018 19:04:14 +0100 schreef Pierre Chapuis:

...


This does not do everything you want, but some libraries just expose
`lua_createtable`.  Are there practical use cases where this is not
enough, i.e. where you need to reserve space in an existing table
as opposed to during table creation?


You are right that reserving space is mostly done at creation of a table and therefore exposing lua_createtable can do the job.
However I think that another table constructor function is not desirable.

My first choice would be the table.rehash variant because in my experiments only reserving the hash part seemed to be relevant. This also gives us the option to optimize a table after it has been populated.

Maybe there are better options for tuning a table than what I proposed.

-- Jasper