[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal: Make creating large arrays faster and "allow" nils in arrays
- From: Jasper Klein <jasper@...>
- Date: Sat, 25 Jul 2020 13:27:51 +0200
Op zaterdag 25 juli 2020 08:29:47 CEST schreef Philippe Verdy:
> and all the rest is populated by
> assignments, the array part is not evolving, there's no strategy to move
> items from the hash part to the array part.
A while back I did some investigation about forcing the size for the array part and the hash part of a table.
In Lua 5.3.5, when the table grows, it may trigger a rehash.
When rehashing, an integer key may be moved to the array part if the sequence is contiguous.
This happens in ltable.c in the functions 'luaH_newkey', 'rehash', 'luaH_resize' and 'reinsert'.
-- Jasper