Ruby 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 Ruby #2 169.71 29,140 1455 656.90 Python 3 #6 913.87 11,080 385 913.83 Python 3 #4 285.20 14,264 950 1,123.47 Ruby 1,466.53 24,936 384 1,466.47 n-body source secs mem gz cpu secs Ruby #3 190.96 25,644 1163 190.95 Ruby #2 218.13 25,684 1137 218.04 Python 3 383.12 11,096 1196 383.11 Python 3 #2 402.59 11,096 1242 402.57 spectral-norm source secs mem gz cpu secs Ruby #4 134.68 27,356 326 134.67 Ruby 136.75 26,644 292 136.69 Ruby #5 57.56 28,488 758 210.10 Python 3 #8 78.36 15,704 407 311.22 Python 3 #6 315.69 11,200 328 315.68 Python 3 #7 89.17 15,516 417 352.71 mandelbrot source secs mem gz cpu secs Python 3 #7 155.28 14,244 688 616.01 Ruby #5 155.55 93,112 970 619.59 Ruby #4 747.10 145,736 857 746.96 Ruby #2 255.19 95,912 880 1,015.91 Ruby #3 1,526.22 25,276 307 1,526.08 Ruby #6 Failed Python 3 #2 Timed Out Python 3 #5 Failed Ruby #7 Failed pidigits source secs mem gz cpu secs Python 3 #3 1.25 13,564 567 1.25 Python 3 #5 1.39 11,428 363 1.39 Ruby #5 1.64 894,828 488 1.64 Ruby #2 4.08 4,777,808 660 4.08 Python 3 #4 4.21 11,096 342 4.21 Ruby 17.24 167,116 518 17.24 regex-redux source secs mem gz cpu secs Python 3 #2 1.38 168,144 1403 2.65 Python 3 8.02 460,684 512 14.90 Ruby #3 12.56 217,132 724 24.73 Ruby #2 24.86 242,680 437 24.84 Ruby #9 29.71 217,156 321 29.71 fasta source secs mem gz cpu secs Ruby #6 26.18 124,704 1069 26.18 Ruby #3 46.23 124,612 1002 46.23 Python 3 #2 49.99 11,088 1121 49.99 Python 3 #3 50.28 11,088 1003 50.27 Python 3 58.84 11,092 817 58.84 Python 3 #5 33.40 827,232 1947 61.49 Ruby #2 105.47 223,092 743 105.46 Ruby #5 112.99 27,152 995 112.98 Ruby #4 113.43 269,460 860 113.28 k-nucleotide source secs mem gz cpu secs Python 3 #3 44.13 262,348 1967 165.01 Python 3 58.56 379,464 607 211.98 Python 3 #8 69.21 505,836 655 214.24 Ruby #2 249.91 202,672 420 249.53 Ruby #3 285.77 209,580 540 285.36 Ruby #7 289.86 397,756 785 287.45 Ruby 83.82 174,084 576 291.63 reverse-complement source secs mem gz cpu secs Python 3 #3 4.96 508,412 796 4.95 Python 3 #5 3.72 1,500,212 954 6.76 Python 3 8.53 1,986,544 479 8.53 Python 3 #2 8.58 1,788,056 434 8.58 Python 3 #6 6.17 2,484,084 814 9.23 Ruby #4 5.60 2,506,468 601 11.05 Ruby #5 11.77 1,615,676 295 11.77 Python 3 #4 12.04 4,002,656 335 12.04 Ruby #3 8.25 4,445,520 482 15.86 Ruby #2 23.00 1,003,740 264 23.00 Ruby 17.18 5,610,896 514 33.33 binary-trees source secs mem gz cpu secs Ruby #4 46.86 569,364 364 46.85 Ruby #2 48.74 569,392 378 48.73 Ruby 48.74 569,348 376 48.74 Ruby #3 50.83 402,724 400 50.80 Ruby #5 18.36 565,588 1008 52.32 Python 3 #2 104.73 271,980 338 104.72 Python 3 #5 35.33 274,884 660 125.79 Python 3 #4 34.53 276,752 472 125.93 Python 3 35.93 276,952 589 126.44 Python 3 #3 50.99 672,016 1238 142.94 Ruby ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [x86_64-linux] Python 3 Python 3.11.1 all Ruby programs & measurements all Python 3 programs & measurements