The Computer Language
24.04 Benchmarks Game

Perl versus Python 3 fastest performance

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
Python 3 #6 1,031.38 19,652 391 1,031.34
Python 3 #4 300.68 19,652 960 1,189.39
Perl #3 1,253.65 19,656 433 1,253.60
Perl #2 428.72 19,656 577 1,710.91
Perl 1,719.04 19,656 463 1,718.97
n-body
source secs mem gz cpu secs
Python 3 #2 362.72 19,656 1247 362.70
Python 3 368.32 19,656 1201 368.30
Perl #2 433.35 19,640 1431 433.33
spectral-norm
source secs mem gz cpu secs
Perl #4 23.84 19,644 562 93.18
Perl #5 97.85 19,640 346 97.84
Perl 106.13 19,644 340 106.10
Python 3 #7 90.77 19,656 425 359.32
Python 3 #6 359.89 19,656 334 359.83
Python 3 #8 98.97 19,656 415 386.79
Perl #2 488.38 19,644 350 488.35
Perl #3 122.80 19,640 857 488.65
mandelbrot
source secs mem gz cpu secs
Python 3 #7 159.49 19,656 698 634.00
Python 3 #3 820.95 19,624 319 820.91
Python 3 #2 232.82 156,340 790 880.90
Python 3 #5 274.66 19,628 463 1,094.30
Perl 569.19 76,928 592 2,273.81
pidigits
source secs mem gz cpu secs
Python 3 #3 1.31 19,784 573 1.31
Python 3 #4 4.73 19,656 348 4.73
Perl 11.68 19,380 471 11.66
Python 3 #5   Failed  
Perl #2   Failed  
Perl #4   Failed  
regex-redux
source secs mem gz cpu secs
Python 3 #2 1.35 168,092 1411 2.62
Python 3 8.83 432,724 515 16.44
Perl 22.47 205,652 471 22.46
Perl #2 17.23 205,436 717 29.80
Perl #4 10.48 157,300 823 30.98
Perl #3 10.69 409,956 854 31.50
Perl #5   Bad Output  
fasta
source secs mem gz cpu secs
Python 3 #2 38.53 19,652 1126 38.53
Python 3 #3 38.86 19,780 1007 38.86
Python 3 #5 26.54 827,148 1951 53.26
Python 3 60.37 19,652 823 60.37
Perl 62.98 55,296 875 62.98
Perl #4 133.86 19,656 969 133.60
Perl #2 182.59 19,656 926 182.43
k-nucleotide
source secs mem gz cpu secs
Perl #2 121.96 659,584 365 120.07
Perl 38.23 1,247,428 659 131.70
Perl #4 41.87 1,070,080 483 136.26
Perl #3 52.15 1,147,904 520 171.73
Python 3 #3 48.64 262,016 1970 184.81
Python 3 #8 87.79 506,880 663 262.44
Python 3 #9 77.06 380,416 614 263.65
Python 3 275.64 500,224 499 274.74
reverse-complement
source secs mem gz cpu secs
Python 3 #3 5.18 509,108 803 5.18
Perl #4 5.65 998,596 268 5.65
Perl #3 6.55 1,495,204 295 6.55
Python 3 #5 4.07 1,500,240 960 7.41
Python 3 #2 10.46 1,788,876 440 10.46
Python 3 10.69 1,987,304 484 10.69
Python 3 #6 7.86 2,484,084 821 11.49
Python 3 #4 13.91 4,003,712 343 13.91
binary-trees
source secs mem gz cpu secs
Python 3 #2 110.47 273,024 344 110.46
Python 3 #4 34.53 277,632 481 126.59
Python 3 #5 35.74 275,456 669 127.53
Python 3 36.16 277,760 597 128.12
Perl #6 38.93 760,064 800 143.68
Python 3 #3 55.05 672,384 1247 158.56
Perl #5 50.13 1,048,576 805 182.28
Perl 248.15 599,680 401 248.14
Perl #4 79.07 2,519,560 769 275.66
Perl #3 107.10 2,200,560 655 361.91
Perl

This is perl 5, version 38
subversion 2 (v5.38.2)
x86_64-linux-thread-multi

Python 3

Python 3.12.2