vs

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

Each chart bar shows, for one unidentified benchmark, how much the fastest Lua program used compared to the fastest Ruby 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 : Are the Lua programs faster? Approximately.

Each table row shows, for one named benchmark, how much the fastest Lua program used compared to the fastest Ruby 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
 mandelbrot1/5 ±
 fasta1/4 ±
 n-body1/3 ±
 spectral-norm1/2 ±
 pidigits1/2 ±
 fannkuch-redux± ±
 regex-dna±±
 k-nucleotide±±±
 binary-trees±
 reverse-complement
 Lua used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/51/51/31/2±

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

 3 : Are the Lua programs faster? Measurements.

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 Ruby program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 mandelbrot 
Lua786.43786.611,044353  0% 0% 0% 100%
Ruby3,857.693,859.075,288307  0% 1% 1% 100%
 fasta 
Lua49.7149.721,1121049  0% 1% 0% 100%
Ruby218.22220.085,380987  1% 1% 1% 100%
 n-body 
Lua461.37461.478361193  0% 0% 0% 100%
Ruby1,433.221,433.665,2881137  0% 0% 0% 100%
 spectral-norm 
Lua243.58243.64940329  0% 0% 0% 100%
Ruby567.84568.016,624326  1% 1% 1% 100%
 pidigits 
Lua2.512.521,460479  0% 1% 1% 100%
Ruby3.973.98590,372478  2% 2% 0% 100%
 fannkuch-redux 
Lua2,131.112,131.55820462  0% 0% 0% 100%
Ruby3,192.973,194.075,284384  0% 1% 1% 100%
 regex-dna 
Lua19.6919.71224,592669  0% 0% 0% 100%
Ruby28.1428.15162,792442  0% 1% 1% 100%
 k-nucleotide 
Lua220.11220.81707,928613  0% 0% 0% 100%
Ruby189.00192.22499,732449  0% 1% 0% 100%
 binary-trees 
Lua449.99450.481,033,624446  0% 14% 4% 100%
Ruby215.18215.26300,436402  1% 1% 0% 100%
 reverse-complement 
Lua22.4922.51724,576555  0% 0% 0% 100%
Ruby10.6310.64127,856255  0% 1% 0% 100%
 fasta-redux 
No program
Ruby1.801.816,560772  0% 1% 1% 99%

 4 : Are there other Lua programs for these benchmarks?

Remember - those are just the fastest Lua and Ruby 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 Ruby 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.2.1 Copyright (C) 1994-2012 Lua.org, PUC-Rio

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

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

Revised BSD license

  Home   Conclusions   License   Play