A Probabilistic Model Revealing Shortcomings in Lua’s Hybrid Tables - Archive ouverte HAL
Communication Dans Un Congrès Année : 2023

A Probabilistic Model Revealing Shortcomings in Lua’s Hybrid Tables

Résumé

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 an associative array called a table. With Lua 5.0, the reference implementation of Lua introduced hybrid tables to implement tables using both a hash table and a dynamically growing array combined together: the values associated with integer keys are stored in the array part, when suitable. All this is transparent to the user, which has 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 Ω(TlogT) with high probability, where linear complexity is expected instead.
Fichier principal
Vignette du fichier
Lua_HashMap_COCOON___final.pdf (380.11 Ko) Télécharger le fichier
Origine Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-04484318 , version 1 (29-02-2024)

Identifiants

Citer

Conrado Martínez, Cyril Nicaud, Pablo Rotondo. A Probabilistic Model Revealing Shortcomings in Lua’s Hybrid Tables. The 28th International Computing and Combinatorics Conference COCOON 2022, Oct 2022, Shenzhen, China. pp.381-393, ⟨10.1007/978-3-031-22105-7_34⟩. ⟨hal-04484318⟩
38 Consultations
42 Téléchargements

Altmetric

Partager

More