1 : At a glance - Are the Lua programs faster?

Each chart bar shows, for one unidentified benchmark, how much the fastest Lua program used compared to the fastest C++ g++ program.

(Memory use is only compared for tasks that require memory to be allocated.)


These are not the only compilers and interpreters. These are not the only programs that could be written. These are not the only tasks that could be solved. These are just 10 tiny examples.

 2 : Approximately - Are the Lua programs faster?

Each table row shows, for one named benchmark, how much the fastest Lua program used compared to the fastest C++ g++ program.

(Memory use is only compared for tasks that require memory to be allocated.)

 Lua used what fraction? used how many times more? 
Benchmark Time Memory Code
 regex-dna±
 k-nucleotide10×1/2
 binary-trees44×1/2
 spectral-norm44× 1/3
 mandelbrot44× 1/2
 n-body65× ±
 fannkuch-redux95× 1/2
 Lua used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)27×44×55×95×95×

± read the measurements and then read the program source code.

 3 : Measurements - Are the Lua programs faster?

These are not the only tasks that could be solved. These are just 10 tiny examples. These are not the only compilers and interpreters. These are not the only programs that could be written.

For each named benchmark, measurements of the fastest Lua program are shown for comparison against measurements of the fastest C++ g++ program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 regex-dna 
Lua31.2631.27340,104596  0% 1% 1% 100%
C++ g++5.335.34170,488695  0% 0% 1% 100%
 k-nucleotide 
Lua242.00242.46724,636613  0% 1% 1% 100%
C++ g++24.0324.04138,9601252  1% 1% 0% 100%
 binary-trees 
Lua481.98482.571,035,484446  0% 1% 1% 100%
C++ g++10.9210.94148,508892  1% 1% 0% 100%
 spectral-norm 
Lua350.78350.861,100329  1% 0% 1% 100%
C++ g++7.927.939241044  0% 1% 1% 100%
 mandelbrot 
Lua1,039.321,039.5918,044623  0% 1% 1% 100%
C++ g++23.4423.4532,1801017  0% 1% 1% 100%
 n-body 
Lua594.32594.468721305  0% 0% 1% 100%
C++ g++9.089.083361544  0% 0% 1% 100%
 fannkuch-redux 
Lua2,593.042,593.59820462  1% 0% 1% 100%
C++ g++27.2227.232841150  0% 1% 1% 100%
 fasta 
LuaFailed
C++ g++0.030.03?1543  100% 0% 0% 100%
 fasta-redux 
No program
C++ g++0.020.03?1474  0% 0% 0% 100%
 reverse-complement 
LuaFailed
C++ g++0.030.03?2275  0% 0% 0% 100%
 pidigits 
LuaFailed
C++ g++0.090.09?682  0% 0% 0% 100%

 4 : Are there other Lua programs for these benchmarks?

Remember - those are just the fastest Lua and C++ g++ programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for Lua.

Maybe one of those other Lua programs is fastest on a different OS/machine.

 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest Lua and C++ g++ programs measured on this OS/machine. Check if there are faster implementations of these benchmark programs for other programming languages.

Maybe one of those other programs is fastest on a different OS/machine.

 Lua : associative arrays for extensible embedded scripting 

online book "Programming in Lua" by Roberto Ierusalimschy

"Game Developers Conference 2010 Lua Tutorial" (slides)

Lua 5.3.0 Copyright (C) 1994-2015 Lua.org, PUC-Rio

Home Page: http://www.lua.org/

Download: http://www.lua.org/download.html

Revised BSD license

  Home   Conclusions   License   Play