
handle: 2117/441913
Lua (Ierusalimschy et al., 1996) is a well-known scripting language, popular among many programmers, most notably in the gaming industry. Remarkably, the only data-structuring mechanism in Lua is given by associative arrays, called tables. With Lua 5.0, the reference implementation of Lua introduced hybrid tables to implement tables using both a hashmap and a dynamically growing array combined together: the values associated with integer keys are stored in the array part, when suitable, everything else is stored in the hashmap. All this is transparent to the user, who gets a unique simple interface to handle tables. In this paper we carry out a theoretical analysis of the performance of Lua's tables, by considering various worst-case and probabilistic scenarios. In particular, we uncover some problematic situations for the simple probabilistic model where we add a new key with some fixed probability p > 1/2 and delete a key with probability 1-p: the cost of performing T such operations is proved to be O(TlogT) with high probability, where linear complexity would be assumed for such data structure. If there is no deletion, we prove that the tables behave better overall. In particular, we establish that inserting the T integers from 1 to T in a random order is done in an essentially linear time.
The work of the first author has been supported by funds from project MOTION (Project PID2020-112581GB-C21) of the Spanish Ministry of Science & Innovation MCIN/AEI/10.13039/501100011033.
Peer Reviewed
data structures, Àrees temàtiques de la UPC::Matemàtiques i estadística, Data structures, Probabilistic analysis of algorithms, Theory of programming languages, hash tables, Analysis of algorithms, Lua, Àrees temàtiques de la UPC::Informàtica, algorithm engineering, probabilistic analysis of algorithms, Hash tables, Algorithm engineering
data structures, Àrees temàtiques de la UPC::Matemàtiques i estadística, Data structures, Probabilistic analysis of algorithms, Theory of programming languages, hash tables, Analysis of algorithms, Lua, Àrees temàtiques de la UPC::Informàtica, algorithm engineering, probabilistic analysis of algorithms, Hash tables, Algorithm engineering
| selected citations These citations are derived from selected sources. This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | 0 | |
| popularity This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network. | Average | |
| influence This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | Average | |
| impulse This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network. | Average |
