The United Nations' 2030 Agenda for Sustainable Development highlights the importance of energy-efficient software to reduce the global carbon footprint. Programming languages and execution models strongly influence software energy consumption, with interpreted languages generally being less efficient than compiled ones. Lua illustrates this trade-off: despite its popularity, it is less energy-efficient than greener and faster languages such as C. This paper presents an empirical study of Lua's runtime performance and energy efficiency across 25 official interpreter versions and just-in-time (JIT) compilers. Using a comprehensive benchmark suite, we measure execution time and energy consumption to analyze Lua's evolution, the impact of JIT compilation, and comparisons with other languages. Results show that all LuaJIT compilers significantly outperform standard Lua interpreters. The most efficient LuaJIT consumes about seven times less energy and runs seven times faster than the best Lua interpreter. Moreover, LuaJIT approaches C's efficiency, using roughly six times more energy and running about eight times slower, demonstrating the substantial benefits of JIT compilation for improving both performance and energy efficiency in interpreted languages.
翻译:联合国《2030年可持续发展议程》强调能效软件对减少全球碳足迹的重要性。编程语言与执行模型对软件能耗具有显著影响,其中解释型语言通常比编译型语言能效更低。Lua语言正是这一权衡的例证:尽管广受欢迎,其能效却低于C语言等更环保、更快速的编程语言。本文通过实证研究,系统评估了25个官方解释器版本及即时编译(JIT)环境下Lua的运行性能与能源效率。基于综合性基准测试套件,我们测量了执行时间与能耗,以分析Lua的演进趋势、JIT编译的影响以及与其他语言的对比。结果表明:所有LuaJIT编译器均显著优于标准Lua解释器。最高效的LuaJIT版本能耗降低约七倍,运行速度提升约七倍。此外,LuaJIT已接近C语言的效率水平——其能耗约为C语言的六倍,运行速度约为C语言的八分之一,这充分证明了JIT编译技术在提升解释型语言性能与能效方面的巨大潜力。