I’ve been playing with Lua a little bit recently and was interested in getting an idea of the performance difference between Lua 5.3 and LuaJIT. (The LuaJIT website has very good page covering benchmarks. I just wanted to play around myself). Like the LuaJIT page I picked a few example programs from The Computer Language Benchmarks Game. Programs were run on a AMD-6300FX running Windows 8.

nbody.lua-4.lua 50000000

Version Elapsed time (s) Kernel time (s) User time (s) Working set (KB)
lua53 469.36 0.05 467.05 2,356
luajit203 26.28 0.00 26.20 2,504
luajit21 26.31 0.00 26.25 2,512

fannkuchredux.lua 12

Version Elapsed time (s) Kernel time (s) User time (s) Working set (KB)
lua53 1717.53 0.14 1710.78 2,284
luajit203 105.33 0.00 105.16 2,528
luajit21 106.06 0.00 105.91 2,536

spectralnorm.lua 5500

Version Elapsed time (s) Kernel time (s) User time (s) Working set (KB)
lua53 199.65 0.03 199.38 2,864
luajit203 4.89 0.00 4.88 2,724
luajit21 4.89 0.00 4.88 2,728

binarytrees.lua-2.lua 2

Version Elapsed time (s) Kernel time (s) User time (s) Working set (KB)
lua53 439.98 13.95 423.66 1,072,400
luajit203 78.34 2.22 75.86 928,076
luajit21 77.92 1.75 75.91 811,984

Summary Relative increase in speed over Lua 5.3.

Benchmark lua53 luajit203 luajit2
nbody.lua-4.lua 50000000 1.00 17.83 17.79
fannkuchredux.lua 12 1.00 16.27 16.15
spectralnorm.lua 5500 1.00 40.86 40.86
binarytrees.lua-2.lua 20 1.00 5.58 5.58