Paper — The Green Side of the Lua
How I co-authored and presented a paper on Lua's runtime performance and energy efficiency at SANER 2026.
Mar 20
5 min read

Lua is small, fast and loved: it has ranked among the four fastest-growing languages on GitHub. Yet in the most cited ranking of programming languages by energy efficiency, it places 23rd out of 27, using almost 46× more energy than C.
But that ranking only measured a single version of Lua's interpreter. So, together with
André Brandão ↗,
Miguel Guimarães ↗,
Simão Cunha ↗ and
João Saraiva ↗, we asked a simple question: what happens when you measure all of it?
The answer became The Green Side of the Lua, which I presented at SANER 2026 ↗, and an extended version that's currently under review for a journal. The full talk is at the end of this post!
The Questions
How We Measured
- Lua
- LuaJIT
- C
- Intel RAPL
- GPS-UP
- Line up the contendersLuaJIT ↗All 17 official Lua interpreters, from 5.3.0 to 5.5.0, plus 7 LuaJIT releases and the LuaJIT Remake project.
- Pick the workloadLuaAOT benchmarks ↗Seven classic programs, like binary-trees, n-body and spectral-norm, with equivalent C versions as a baseline.
- Measure the energyIntel RAPLEach program runs 10 times while the CPU reports the energy used by the processor and the memory.
- Keep it fairBefore every run, the CPU has to cool back down to its idle temperature, and outliers are filtered out.
- Score itGPS-UPSpeedup, Greenup and Powerup tell us how much faster and greener each version is, and whether it draws more power to get there.
What We Found
Climbing the Ranking
Back to that energy ranking. With LuaJIT 2.0.4, Lua needs only 5.63× the energy of C and runs 7.85× slower, instead of the 38.04× and 54.74× of Lua 5.4.7. That's enough to climb past several languages:
- places in energy with LuaJIT
- +5
- places in runtime with LuaJIT
- +9
It's an indicative comparison, since the original ranking was measured on different hardware, but the message is clear: Lua's poor standing comes from the interpreter, not the language.
Running on Empty
Electric cars are rated by how far they can go on a full charge, so we did the same with a laptop: charge it to 100%, run the same program in a loop until the battery dies, and count. If every run were a kilometer, C would drive 604 km, LuaJIT 109 km, and the Lua interpreter just 19 km.
| Name | runs |
|---|---|
| C | 604 604 runs · 16.6 s each, battery lasted 2.77 h |
| LuaJIT 2.0.4 | 109 109 runs · 88.2 s each, battery lasted 2.65 h |
| Lua 5.4.7 | 19 19 runs · 488.2 s each, battery lasted 2.44 h |
| LuaAOT | 18 18 runs · 422.3 s each, battery lasted 2.03 h |
The Extended Version
The conference paper was just the beginning. In the extended version, where I share first authorship with André and Miguel, we took the study a lot further:
- Lua environments
- 26
- programs
- 30
- benchmark suites
- 5
Besides Lua 5.5.0 and LuaJIT 2.1, we added a third way of running Lua: ahead-of-time compilation, with LuaAOT. And since speed-tuned benchmarks don't look much like everyday Lua, we added four suites built on popular Lua libraries, covering linear algebra, functional pipelines, data structures and object-oriented code:
- LuaMatrix
- LuaFun
- Penlight Collections
- Penlight OO Classes
Measuring everything took over 11 hours of execution, and more than a day once you count the cool-downs between runs. Here's what came out of it:
The poor standing of Lua in global energy rankings is largely an artifact of evaluating legacy interpreters.
Every chart and table is in its online appendix ↗.
The Talk
I presented the paper at the 1st International Workshop on Green Software Evolution, part of SANER 2026, in Limassol, Cyprus. Here's the full talk: