Tables have a 'lastfree' information only when needed

Only tables with some minimum number of entries in their hash part
have a 'lastfree' field, kept in a header before the node vector.
This commit is contained in:
Roberto Ierusalimschy
2022-11-01 15:42:08 -03:00
parent ee645472eb
commit 8047b2d03e
7 changed files with 84 additions and 24 deletions

View File

@@ -210,9 +210,9 @@ assert(T.querytab(a) == 64) -- array part has 64 elements
a[32] = true; a[48] = true; -- binary search will find these ones
a[51] = true -- binary search will miss this one
assert(#a == 48) -- this will set the limit
assert(select(4, T.querytab(a)) == 48) -- this is the limit now
assert(select(3, T.querytab(a)) == 48) -- this is the limit now
a[50] = true -- this will set a new limit
assert(select(4, T.querytab(a)) == 50) -- this is the limit now
assert(select(3, T.querytab(a)) == 50) -- this is the limit now
-- but the size is larger (and still inside the array part)
assert(#a == 51)