aboutsummaryrefslogtreecommitdiff
path: root/testes/nextvar.lua (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Removed copyright notice from 'testes/all.lua'Roberto Ierusalimschy7 days1-1/+1
| | | | All test files refer to the main copyright notice in 'lua.h'.
* New way to keep hints for table lengthRoberto Ierusalimschy2024-11-291-15/+14
| | | | | | | | | | Instead of using 'alimit' for keeping the size of the array and at the same time being a hint for '#t', a table now keeps these two values separate. The Table structure has a field 'asize' with the size of the array, while the length hint is kept in the array itself. That way, tables with no array part waste no space with that field. Moreover, the space for the hint may have zero cost for small arrays, if the array of tags plus the hint still fits in a single word.
* Add extra size when resizing tables with deleted keysRoberto Ierusalimschy2024-11-141-1/+61
| | | | | | | | Without this extra space, sequences of insertions/deletions (and some other uses) can have unpexpected low performances. See the added tests for an example, and *Mathematical Models to Analyze Lua Hybrid Tables and Why They Need a Fix* (Martínez, Nicaud, Rotondo; arXiv:2208.13602v2) for detais.
* New rule for size of array partRoberto Ierusalimschy2024-11-131-18/+54
| | | | | | | | Array part needs 1/3 of its elements filled, instead of 1/2. Array entries use ~1/3 the memory of hash entries, so this new rule still ensures that array parts do not use more memory than keeping the values in the hash, while allowing more uses of the array part, which is more efficient than the hash.
* Table rehash can resize only the hash partRoberto Ierusalimschy2024-10-281-3/+22
| | | | | | | If there are no integer keys outside the array part, there is no reason to resize it, saving the time to count its elements. Moreover, assignments to non-integer keys will not collapse a table created with 'table.create'.
* Merge branch 'master' into nextversionRoberto Ierusalimschy2022-12-281-1/+1
|\
| * Avoid excessive name pollution in test filesRoberto Ierusalimschy2022-12-281-1/+1
| | | | | | | | | | Test files are more polite regarding the use of globals when locals would do, and when globals are necessary deleting them after use.
* | Control variables in for loops are read onlyRoberto Ierusalimschy2022-12-211-4/+6
| |
* | Tables have a 'lastfree' information only when neededRoberto Ierusalimschy2022-11-011-2/+2
|/ | | | | Only tables with some minimum number of entries in their hash part have a 'lastfree' field, kept in a header before the node vector.
* New test for table rehashRoberto Ierusalimschy2022-09-161-9/+29
|
* Avoid overflows when incrementing parameters in CRoberto Ierusalimschy2021-09-221-0/+17
| | | | | | Any C function can receive maxinteger as an integer argument, and therefore cannot increment it without some care (e.g., doing unsigned arithmetic as the core does).
* Allow yields inside '__pairs'Roberto Ierusalimschy2021-03-291-0/+21
|
* Fixed bug of keys removed from tables vs 'next'Roberto Ierusalimschy2020-10-141-0/+32
| | | | | | Fixed the bug that a key removed from a table might not be found again by 'next'. (This is needed to allow keys to be removed during a traversal.) This bug was introduced in commit 73ec04fc.
* Better tests for gray listsRoberto Ierusalimschy2020-08-071-0/+2
| | | | | Test uses an extra bit in 'marked' to mark all elements in gray lists and then check against elements colored gray.
* DetailsRoberto Ierusalimschy2020-02-271-1/+1
| | | | | Several details in code (e.g., moving a variable to the most inner scope that encloses its uses), comments, parameter names, extra tests.
* Small corrections when setting 'L->top'Roberto Ierusalimschy2019-07-251-1/+2
| | | | | | | | | - OP_NEWTABLE can use 'ra + 1' to set top (instead of ci->top); - OP_CLOSE doesn't need to set top ('Protect' already does that); - OP_TFORCALL must use 'ProtectNT', to preserve the top already set. (That was a small bug, because iterators could be called with extra parameters besides the state and the control variable.) - Comments and an extra test for the bug in previous item.
* Unification of size representation in OP_NEWTABLE and OP_SETLISTRoberto Ierusalimschy2019-07-151-10/+18
| | | | | | Opcodes OP_NEWTABLE and OP_SETLIST use the same representation to store the size of the array part of a table. This new representation can go up to 2^33 (8 + 25 bits).
* OP_NEWTABLE keeps exact size of arraysRoberto Ierusalimschy2019-07-121-33/+19
| | | | | | OP_NEWTABLE is followed by an OP_EXTRAARG, so that it can keep the exact size of the array part of the table to be created. (Functions 'luaO_int2fb'/'luaO_fb2int' were removed.)
* Details in the implementation of the integer 'for' loopRoberto Ierusalimschy2019-03-211-0/+6
| | | | | | | | Changed some implementation details; in particular, it is back using an internal variable to keep the index, with the control variable being only a copy of that internal variable. (The direct use of the control variable demands a check of its type for each access, which offsets the gains from the use of a single variable.)
* New semantics for the integer 'for' loopRoberto Ierusalimschy2019-03-191-5/+68
| | | | | | | | | | | The numerical 'for' loop over integers now uses a precomputed counter to control its number of iteractions. This change eliminates several weird cases caused by overflows (wrap-around) in the control variable. (It also ensures that every integer loop halts.) Also, the special opcodes for the usual case of step==1 were removed. (The new code is already somewhat complex for the usual case, but efficient.)
* Added directory to test file names in '$Id:'Roberto Ierusalimschy2018-07-251-1/+1
| | | | | | | From the point of view of 'git', all names are relative to the root directory of the project. So, file names in '$Id:' also should be relative to that directory: the proper name for test file 'all.lua' is 'testes/all.lua'.
* Added manual and tests for version 5.4-w2Roberto Ierusalimschy2018-07-091-0/+669