lua-users home
lua-l archive

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


> It would be great to be able to say that all table operations are nearly
> linear in non-pathological tables except when the table has to change size.
> Right now that's not true of Lua's tables since they will rehash just to
> reset firstfree.  At least make it a fast linear scan and not a reallocation
> and reinsert of ever element.  That means that what one might think is a
> nice non-growing table (like a cache of n elements) will occasionally give
> set operations that take a LOT longer than others set operations.

Thinking about it more when there is a collision in the hash, there needs to
be the same sort of linear scan to update firstfree that ltable.c has now.
So there is a linear component to resolving collisions.  At least that one
is fast.  

I still think table should never be reallocated and reinserted unless they
are changing size.  Meaning that setnodevector(L, t, oldsize); needs to be
removed from the code by resetting firstfree some other way.

Russ