← Back to context

Comment by EGreg

1 year ago

Is Lua currently even faster than JS and PHP, after all the effort that went into those languages’ optimizations?

It depends. In Debian's [0][1] benchmarks, JS is clearly ahead in a handful of the benchmarks, but in the rest, Lua is either on-par or faster. They're within a shout of each other.

There are some places where Lua has surprisingly poor performance. However, in almost everything else, it's one of the fastest around. Luajit is still one of the fastest JITs in existence.

In the real world, rather than constraints of a benchmark, Lua tends to be on-par from what I've seen. When you're not cold-cacheing everything, its memory use is lower. But it's standard library is ISO-C, and that's about it. No batteries. And the others beat it soundly there, whilst being close to the same performance. Which will mean they will just about always win out.

[0] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

I did performance measurements in 2020 based on the Are-we-fast-yet benchmark suite which combines micro and larger benchmarks.

Here are the results: http://software.rochus-keller.ch/are-we-fast-yet_lua_results...

Overall, the JS/V8 version was twice as fast as the Lua/LuaJIT version. LuaJIT was only faster in the Mandelbrot benchmark. The recent PUC Lua version 5.4.1 is even ten times slower than the V8 version at the time. More recent V8 will likely be even faster. The results also demonstrate that one can get a pretty false impression when just looking at single microbenchmarks.