The Computer Language
24.11 Benchmarks Game

Perl versus Lua fastest performance

How the programs are written matters! Always look at the source code.

If the fastest programs are * hand-written vector instructions, does the host language matter? You might be more interested in the less optimised programs — more seconds, less gz source code.

fannkuch-redux
source secs mem gz cpu secs
Lua 603.40 19,652 469 603.36
Perl #3 1,365.70 19,684 433 1,365.66
Perl #2 442.57 19,684 577 1,766.92
Perl 1,805.89 19,684 463 1,805.83
n-body
source secs mem gz cpu secs
Lua #2 220.08 19,656 1200 220.07
Lua #4 223.32 19,656 1312 223.30
Lua 262.10 19,656 1207 262.08
Perl #2 444.89 19,688 1431 444.87
spectral-norm
source secs mem gz cpu secs
Lua 78.68 19,652 335 78.68
Perl #5 96.53 19,688 346 96.53
Perl 96.60 19,688 340 96.59
Perl #4 24.86 19,688 562 97.92
Perl #3 126.48 19,688 857 498.55
Perl #2 508.73 19,688 350 508.70
mandelbrot
source secs mem gz cpu secs
Lua #3 345.71 19,656 364 345.68
Lua 348.76 19,656 365 348.74
Lua #2 376.55 19,656 373 376.53
Lua #6 114.06 282,112 630 400.14
Perl 498.72 76,928 592 1,979.43
fasta
source secs mem gz cpu secs
Lua #3 24.08 19,652 1065 24.08
Lua #2 24.15 19,652 1065 24.14
Perl 60.07 55,296 875 60.07
Perl #4 126.60 19,684 969 125.89
Perl #2 189.89 19,684 926 189.24
k-nucleotide
source secs mem gz cpu secs
Lua #2 97.17 596,604 620 97.16
Perl #2 139.32 659,584 365 137.50
Perl #4 45.38 1,070,336 483 151.76
Perl 43.90 1,247,396 659 154.01
Perl #3 56.61 1,148,032 520 193.68
reverse-complement
source secs mem gz cpu secs
Perl #4 5.76 998,608 268 5.76
Perl #3 6.77 1,495,228 295 6.76
Lua #2 41.12 2,654,652 560 41.10
Lua #5 41.96 2,169,636 758 41.96
Lua #4 49.35 1,030,016 600 49.33
binary-trees
source secs mem gz cpu secs
Lua #2 141.55 956,672 418 141.52
Perl #6 40.21 760,192 800 148.50
Lua #3 83.71 809,856 690 167.26
Lua #4 48.65 956,672 670 180.27
Perl #5 52.18 1,048,704 805 189.88
Perl 263.97 599,424 401 263.95
Perl #4 79.54 2,519,560 769 287.74
Perl #3 110.37 2,200,700 655 374.11
pidigits
source secs mem gz cpu secs
Perl 13.27 19,684 471 13.26
Perl #2   Failed  
Perl #4   Failed  
* Lua #7   Failed  
* Lua #5   Failed  
* Lua   Failed  
regex-redux
source secs mem gz cpu secs
Perl 22.28 205,748 471 22.28
Perl #2 17.06 205,440 717 29.44
Perl #4 10.21 157,444 823 30.52
Perl #3 10.36 410,236 857 30.81
Perl #5   Bad Output  
Lua   Failed  
Perl

This is perl 5, version 40
subversion 0 (v5.40.0)
x86_64-linux-thread-multi

Lua

Lua 5.4.6 Copyright (C)
1994-2023 Lua.org, PUC-Rio