lua-users home
lua-l archive

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



On 25-Sep-06, at 2:29 PM, Glenn Maynard wrote:

On Mon, Sep 25, 2006 at 12:17:16PM +0200, Mike Pall wrote:
See the patch below. This comes standard with LuaJIT because the
effect is much more pronounced there.

With this patch, I'm still seeing a 4:1 change in the attached code,
depending on the setting of "fast".  Does it repro for you?

That's a bit of a chimera, I think. The registry is initially created with no array part at all and a hash part capable of containing 2 keys. Until the hash part overflows, the array part is not created. So your "fast" setting guarantees that the hash part will overflow on the first trip through the loop, at which point it will get an array part of size 4, which will speed up the remaining accesses in the loop.

Another reason why micro-benchmarks can be misleading, I guess.