Mathematical Models to Analyze Lua Hybrid Tables and Why They Need a Fix
Conrado Mart\'inez, Cyril Nicaud, Pablo Rotondo

TL;DR
This paper analyzes the performance of Lua's hybrid tables, revealing problematic scenarios where their complexity can degrade from linear to logarithmic, highlighting the need for improvements.
Contribution
It provides a theoretical analysis of Lua's hybrid tables, identifying worst-case scenarios that cause performance degradation and suggesting the need for fixes.
Findings
Performance degrades to (T \u2212 T T) in worst-case probabilistic scenarios
Hybrid tables can exhibit (T T T) complexity under certain operations
The analysis highlights the necessity for improvements in Lua's table implementation.
Abstract
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 are 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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsParallel Computing and Optimization Techniques · Advanced Database Systems and Queries · Formal Methods in Verification
