lua-users home
lua-l archive

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


What I propose does not even need any specific annotation or new syntax, just an additional function to the existing "table.*" API.

Le mar. 26 mai 2020 à 21:27, Philippe Verdy <verdyp@gmail.com> a écrit :
I have just proposed an API for table tuning and getting statistics... and allwing to select its implementation... or even develop a new one in Lua itself.
Just look at the message where I describe "state = table.def(params, tab)" (and its relation with the local environment where defaults for new tables can be specified, saved/restored and where this can also be done talbe by table after their construction)


Le mar. 26 mai 2020 à 20:46, Andrea <andrea.l.vitali@gmail.com> a écrit :

> code. Interestingly, though, the NEWTABLE opcode in Lua bytecode has
 :
Correction for the record: like lua_createtable, not lua_newtable.

Thank you very much for confirming what can be done.

In the old Lua there ware different constructors: (3), [a,b,c], {a, b,c}; first to create a table of specified size, second to create a table with the array part, third to create a table with the hash part filled as specified.

For the new Lua 5.4, has somebody already proposed/discussed a possible way to annotate the constructor {} so that it creates a table with specified size?

Or it was deemed irrelevant because amortized cost of rehash is small and therefore does not matter? (I agree on this - but I want to design an application which has no big "pauses" caused by rehash of big tables)

   Andrea

--
Andrea Vitali