The Computer Language
25.03 Benchmarks Game

Perl versus Lua

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

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

fannkuch-redux      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua 604.54 604.44 3,330 469 0.17
Perl #3 1,275.15 1,274.31 7,512 433
Perl #2 432.70 1,723.38 16,654 577
Perl 1,836.45 1,835.47 7,524 463
n-body      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua #2 216.21 222.12—231.65 3,269 1200 0.10
Lua #4 216.59 224.22—232.39 3,273 1312 0.18
Lua 244.50 250.36—259.88 3,273 1207 0.19
Perl #2 452.42 451.65 8,741 1431
spectral-norm      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua 77.63 77.91—90.12 3,568 335 0.19
Perl 96.09 99.70—107.03 10,101 340
Perl #5 96.18 100.00—106.61 10,162 346
Perl #4 24.85 100.86—104.46 14,885 562
Perl #2 513.08 512.36 9,581 350
Perl #3 130.52 517.15 14,729 857
mandelbrot      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua #3 487.31 487.90—488.97 3,711 364 0.18
Lua 500.61 500.82—501.71 3,707 365 0.16
Lua #2 523.44 524.95—527.02 3,232 373 0.15
Lua #6 159.01 557.36—558.01 652,796 630 0.10
Perl 494.54 1,973.84 114,569 592
fasta      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua #2 24.14 24.33—26.33 3,686 1065 0.20
Lua #3 24.15 24.17—25.73 3,682 1065 0.18
Perl 59.63 60.57—63.69 58,769 875
Perl #4 117.88 118.80—121.19 8,438 969
Perl #2   Bad Output  
k-nucleotide      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua #2 90.52 90.72—91.24 613,040 620 0.15
Perl #2 112.16 112.36—124.48 678,937 365
Perl 35.15 128.21—141.29 1,286,410 659
Perl #4 38.15 136.37—149.89 1,101,009 483
Perl #3 51.38 179.70—188.04 1,180,799 520
reverse-complement      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Perl #4 5.80 5.77—5.87 1,026,572 268
Perl #3 6.84 6.87—7.18 1,535,848 295
Lua #2 38.73 38.89—39.62 2,724,770 560 0.18
Lua #5 42.84 44.40—45.94 2,227,048 758 0.20
Lua #4 46.06 46.12—48.03 653,398 600 0.18
binary-trees      [ Contentious. Different approaches. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua #2 142.32 145.28—148.96 1,043,743 418 0.13
Perl #6 39.22 147.06—153.67 782,742 800
Lua #3 82.05 164.78—165.70 1,753,616 690 0.18
Lua #4 47.56 175.72—176.19 2,055,766 670 0.16
Perl #5 50.17 187.41—199.93 1,078,489 805
Perl 258.70 260.68—271.58 617,132 401
Perl #4 77.36 278.64—288.66 2,587,648 769
Perl #3 110.03 369.87 2,260,713 655
pidigits      [ Contentious. Different libraries. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
* Lua 2.99 3.02 24,666 482 0.13
Perl 13.47 13.51—13.66 16,441 471
Perl #2   Empty  
Perl #4   Empty  
* Lua #7   Empty  
Lua #6   Empty  
* Lua #5   Empty  
regex-redux      [ Contentious. Different libraries. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua 2.59 2.59 360,264 488 0.17
Perl 22.37 22.36—22.45 212,926 471
Perl #2 17.14 29.70—31.19 212,640 717
Perl #3 10.40 31.11—32.64 529,801 857
Perl #5   Bad Output  
Perl #4   Bad Output  
Perl

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

Lua

Lua 5.4.7 Copyright (C)
1994-2024 Lua.org, PUC-Rio