lua-users home
lua-l archive

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


-- Sorry for the quick double post

I should have checked beforehand, but after poking around ltable.c it looks like
it's a design decision that tables are (almost) never shrunk.

The only reason it shrunk the array when the hash table was used in the example
was because the hash table had previously been unused - requiring it to grow and
reevaluate its array size. So it looks like you can't count on a table being
shrunk... I would be very interested to see a program in which this would be a
problem though. Most high speed allocators rarely shrink blocks anyway; even if
requested.

I have a feeling any possible patch would slow table setting considerably =/

- Alex