[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua table internals: firstfree and numuse?
- From: Russ Webb <Russell.Webb@...>
- Date: Thu, 07 Mar 2002 15:26:49 -0800
> 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