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/5 ±
 pidigits1/4 
 n-body1/3 ±
 spectral-norm1/2 ±
 fannkuch-redux1/2 ±
 regex-dna1/2
 reverse-complement
 binary-trees±
 k-nucleotide1/2
 Lua used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/51/51/41/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 
Lua44.8044.81816353  0% 1% 0% 100%
Ruby242.02242.095,368307  1% 0% 0% 100%
 fasta 
Lua49.7149.721,1121049  0% 1% 0% 100%
Ruby234.24234.705,380987  1% 1% 1% 100%
 pidigits 
Lua2.512.521,460479  0% 1% 1% 100%
Ruby11.2711.2973,448240  0% 1% 1% 100%
 n-body 
Lua47.6447.668361193  0% 0% 0% 100%
Ruby143.56143.605,4561137  0% 1% 0% 100%
 spectral-norm 
Lua243.58243.64940329  0% 0% 0% 100%
Ruby607.99608.156,016326  0% 1% 1% 100%
 fannkuch-redux 
Lua2,131.112,131.55820462  0% 0% 0% 100%
Ruby3,316.173,317.055,348384  0% 1% 1% 100%
 regex-dna 
Lua19.6919.71224,592669  0% 0% 0% 100%
Ruby29.8329.84143,640442  0% 1% 1% 100%
 reverse-complement 
Lua22.4922.51724,576555  0% 0% 0% 100%
Ruby11.0411.05129,852255  0% 1% 1% 100%
 binary-trees 
Lua449.99450.481,033,624446  0% 14% 4% 100%
Ruby212.24212.32135,148402  0% 1% 1% 100%
 k-nucleotide 
Lua220.11220.81707,928613  0% 0% 0% 100%
Ruby51.9752.02357,432996  0% 1% 1% 100%
 fasta-redux 
No program
Ruby1.931.946,608772  2% 0% 1% 100%

 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