Table of Contents
Fetching ...

The Green Side of the Lua

André Brandão, Diogo Matos, Miguel Guimarães, Simão Cunha, João Saraiva

TL;DR

This paper analyzes energy efficiency in Lua across interpreters and JIT engines to quantify evolution in both runtime and energy use, and to assess the impact of Just-In-Time compilation. It uses Intel RAPL-based measurements on a controlled Linux laptop to compare 17 Lua interpreters and 8 LuaJIT variants with a LuaAOT benchmark suite and C baselines. Key findings show that LuaJIT dramatically outperforms pure Lua interpreters, with LuaJIT 2.0.4 offering about $7\times$ faster runtimes and $7\times$ lower energy than the best interpreter, while consuming roughly $6\times$ more energy and running $8\times$ slower than C. These results substantiate JIT as a viable path to greener interpreted languages and provide a quantitative baseline to guide language design and optimization for energy efficiency, with data and methods openly available for replication.

Abstract

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.

The Green Side of the Lua

TL;DR

This paper analyzes energy efficiency in Lua across interpreters and JIT engines to quantify evolution in both runtime and energy use, and to assess the impact of Just-In-Time compilation. It uses Intel RAPL-based measurements on a controlled Linux laptop to compare 17 Lua interpreters and 8 LuaJIT variants with a LuaAOT benchmark suite and C baselines. Key findings show that LuaJIT dramatically outperforms pure Lua interpreters, with LuaJIT 2.0.4 offering about faster runtimes and lower energy than the best interpreter, while consuming roughly more energy and running slower than C. These results substantiate JIT as a viable path to greener interpreted languages and provide a quantitative baseline to guide language design and optimization for energy efficiency, with data and methods openly available for replication.

Abstract

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.
Paper Structure (21 sections, 3 equations, 6 figures, 2 tables)

This paper contains 21 sections, 3 equations, 6 figures, 2 tables.

Figures (6)

  • Figure 1: Energy Consumption Across Lua Interpreters And LuaJIT Compilers.
  • Figure 2: Runtime Across Lua Interpreters And LuaJIT Compilers.
  • Figure 3: Correlation matrix of runtime, Package energy, and DRAM energy across all Lua versions.
  • Figure 4: Energy Consumption Trends Across Lua Versions and CLBG Problems.
  • Figure 5: GPS-UP Software Energy Efficiency Quadrant: All LuaJIT versions in Zone With Less Energy and Faster Runtime Than All Lua Releases.
  • ...and 1 more figures