The Computer Language
25.02 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 667.45 666.97 3,363 469
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 220.15 225.78—234.77 3,289 1200
Lua #4 225.31 229.08—235.54 3,285 1312
Lua 251.60 259.27—269.77 3,281 1207
Perl #2 452.42 451.65 8,741 1431
spectral-norm      
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua 78.75 78.70—78.87 3,686 335
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 345.21 344.63 36,647 365
Lua #3 345.67 345.17 36,696 364
Lua #2 377.62 377.09 36,393 373
Lua #6 115.81 399.61 652,812 630
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.12 24.07—25.28 3,695 1065
Lua #3 24.16 24.28—25.66 3,695 1065
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 99.19 99.36—99.94 612,901 620
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 40.51 40.80—41.22 2,724,557 560
Lua #5 42.76 43.44—44.96 2,227,057 758
Lua #4 49.30 49.51—50.34 1,057,935 600
binary-trees      [ Contentious. Different approaches. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
Lua #2 141.62 142.08—143.60 982,589 418
Perl #6 39.22 147.06—153.67 782,742 800
Lua #3 82.77 166.40—166.97 1,783,443 690
Lua #4 48.21 178.90—179.68 2,606,240 670
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
Perl 13.47 13.51—13.66 16,441 471
Perl #2   Empty  
Perl #4   Empty  
* Lua #7   Empty  
* Lua #5   Empty  
* Lua   Empty  
regex-redux      [ Contentious. Different libraries. ]
  elapsed Mean or 95% CI      
source secs cpu secs mem gz make
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  
Lua   Empty  
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.6 Copyright (C)
1994-2023 Lua.org, PUC-Rio