lua-users home
lua-l archive

Re: Calculating estimate for size of a lua table

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


Lars Müller:

[ I did some benchmarking using the following code:
for i = 1, 10 do collectgarbage">引用]
 
 You should look out since as you noted the length of the array and
 hash part are power of two's, so in the worst case this can give
 double the cost when using random lengths. So using power of two's
 instead of 1e7 would be better.
[
For the list part I simply used ">引用] I would argue that this is not surprising as LuaJIT uses NaN boxing which allows to store all values in 8 bytes instead of the 16 used by PUC Lua which is reflected in your benchmarking.

Regards,
Xmilia

AltStyle によって変換されたページ (->オリジナル) /