The Computer Language
22.05 Benchmarks Game

Fastest cpu secs Perl versus Ruby

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 cpu seconds, less gz source code.

fannkuch-redux
source mem gz cpu
Ruby #2 288,852 1455 1,010.75
Perl #3 5,064 427 1,267.96
Perl #2 12,308 570 1,626.37
Perl 5,288 457 1,731.08
Ruby 285,268 384 1,748.13
n-body
source mem gz cpu
Ruby #3 285,504 1163 219.69
Ruby #2 285,552 1137 224.66
Perl #2 6,280 1429 492.03
spectral-norm
source mem gz cpu
Perl #4 12,044 555 92.70
Perl #5 7,732 340 99.89
Perl 7,708 333 105.24
Ruby #4 287,424 326 113.59
Ruby 286,944 292 142.22
Ruby #5 288,548 758 216.98
Perl #2 7,040 343 484.05
Perl #3 18,328 850 498.71
mandelbrot
source mem gz cpu
Ruby #5 324,320 970 655.37
Ruby #4 409,304 857 857.98
Ruby #2 361,904 880 1,069.66
Ruby #3 285,212 307 1,470.34
Perl 62,064 586 1,883.51
Ruby #7   Failed  
Ruby #6   Failed  
pidigits
source mem gz cpu
Ruby #5 846,476 485 1.69
Perl #4 8,356 261 1.84
Perl #2 8,368 389 1.96
Ruby #2 613,348 658 2.74
Perl 12,616 463 9.93
Ruby 451,736 518 17.65
regex-redux
source mem gz cpu
Perl 205,584 464 21.87
Ruby #3 649,832 724 23.22
Ruby #2 684,764 437 23.23
Ruby #9 678,228 321 25.87
Perl #2 204,960 710 28.74
Perl #3 157,276 854 29.80
Perl #4 157,228 820 29.95
Perl #5   Bad Output  
fasta
source mem gz cpu
Ruby #6 340,624 1069 27.24
Ruby #3 337,560 1002 50.87
Perl 55,124 871 62.41
Ruby #4 541,176 860 97.62
Ruby #5 286,228 995 98.69
Perl #4 6,336 966 129.28
Ruby #2 480,812 743 153.89
Perl #2 6,224 922 198.31
k-nucleotide
source mem gz cpu
Perl #2 659,704 359 131.83
Perl 1,253,716 652 146.30
Perl #4 1,069,344 476 150.18
Perl #3 1,147,148 513 184.94
Ruby #2 455,288 420 243.58
Ruby #7 657,660 785 271.49
Ruby 408,036 576 281.84
Ruby #3 461,428 540 282.00
reverse-complement
source mem gz cpu
Perl #3 1,495,156 287 6.47
Ruby #5 1,874,980 295 11.49
Ruby #3 2,272,876 482 19.15
Ruby #2 774,468 264 19.40
Ruby #4 2,273,936 601 22.60
Ruby 2,273,352 514 32.89
binary-trees
source mem gz cpu
Ruby #4 667,224 364 68.23
Ruby 667,228 376 71.73
Ruby #3 896,992 400 72.06
Ruby #2 667,172 378 72.24
Ruby #5 671,376 1008 75.52
Perl #5 1,048,472 797 209.51
Perl 599,520 395 252.39
Perl #4 2,519,768 761 274.10
Perl #3 2,200,608 648 390.15
Perl

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

Ruby

ruby 3.1.2p20
(2022-04-12
revision 4491bb740a)
[x86_64-linux] --yjit