The Computer Language
24.11 Benchmarks Game

Python 3 versus Java -Xint fastest performance

How the programs are written matters! 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
Java -Xint #3 499.95 36,780 1264 500.14
Java -Xint 133.97 37,284 1289 530.29
Java -Xint #2 697.49 36,236 520 697.74
Java -Xint #8 707.70 36,720 517 707.97
Python 3 #6 1,033.31 19,312 391 1,033.27
Python 3 #4 302.37 19,312 960 1,196.45
Python 3 #8 2,259.59 19,312 414 2,259.50
n-body
source secs mem gz cpu secs
Java -Xint #4 159.50 37,652 1495 159.56
Java -Xint #8 160.65 37,692 1322 160.71
Java -Xint #3 176.10 37,780 1436 176.16
Java -Xint #2 178.95 37,716 1430 179.00
Java -Xint 187.79 37,816 1437 187.85
Java -Xint #5 242.21 37,820 1435 242.29
Python 3 355.06 19,312 1201 355.05
Python 3 #2 374.16 19,312 1247 374.14
Python 3 #8 518.11 19,312 1172 518.09
spectral-norm
source secs mem gz cpu secs
Java -Xint #2 16.96 38,692 956 67.27
Java -Xint #8 79.75 38,572 453 79.77
Java -Xint #3 26.20 39,420 762 103.20
Python 3 #6 347.53 19,316 334 347.52
Python 3 #4 90.52 19,308 415 359.95
Python 3 #8 379.97 19,440 334 379.96
Python 3 #7 97.11 19,316 425 380.79
mandelbrot
source secs mem gz cpu secs
Java -Xint 359.45 37,564 671 359.57
Java -Xint #3 119.76 76,220 910 478.11
Java -Xint #4 162.05 100,116 667 606.17
Java -Xint #8 632.34 36,580 441 632.40
Python 3 #7 172.20 19,312 698 687.68
Java -Xint #2 204.60 75,772 802 817.30
Java -Xint #6 213.99 75,776 808 854.15
Python 3 #3 861.76 19,312 319 861.73
Python 3 #2 235.71 95,164 790 926.30
Python 3 #5 257.00 19,312 463 1,026.96
Python 3 #8 1,528.00 19,364 379 1,527.73
fasta
source secs mem gz cpu secs
Java -Xint #5 8.92 41,784 2478 23.38
Java -Xint #4 25.45 37,036 1528 25.46
Java -Xint #6 9.13 41,896 2549 30.76
Java -Xint #2 36.96 36,780 1259 36.97
Python 3 #2 39.00 19,312 1126 39.00
Python 3 #3 39.12 19,312 1007 39.12
Python 3 #5 27.86 827,284 1951 53.94
Python 3 57.21 19,312 823 57.20
Python 3 #8 259.98 19,312 730 259.80
Java -Xint #8 673.66 107,836 894 673.30
k-nucleotide
source secs mem gz cpu secs
Python 3 #3 50.15 262,368 1970 185.77
Python 3 #4 79.01 506,112 663 236.67
Python 3 238.45 499,072 499 237.78
Python 3 #8 238.78 623,448 525 237.93
Python 3 #9 68.33 379,392 614 238.74
Java -Xint 174.09 358,964 1821 431.66
Java -Xint #4 722.69 188,368 1887 722.99
Java -Xint #5 358.39 208,936 2225 832.08
Java -Xint #3 380.98 358,232 1642 1,244.14
Java -Xint #6 380.79 358,368 1614 1,245.37
Java -Xint #8   Timed Out  
reverse-complement
source secs mem gz cpu secs
Python 3 #3 4.86 507,712 803 4.86
Python 3 #5 4.09 1,500,716 960 7.41
Python 3 #2 10.08 1,788,136 440 10.08
Python 3 10.29 1,986,440 484 10.29
Python 3 #6 7.38 2,484,372 821 10.89
Python 3 #4 13.41 4,002,688 343 13.41
Java -Xint #6 39.58 2,028,304 760 48.30
Java -Xint #4 80.02 1,883,324 656 80.03
Java -Xint #5 179.32 1,090,164 1115 175.61
Java -Xint #7 733.63 1,031,048 1654 1,704.56
Java -Xint #3   Bad Output  
binary-trees
source secs mem gz cpu secs
Java -Xint #3 66.79 1,343,436 546 67.51
Java -Xint #6 67.36 1,378,776 535 68.09
Java -Xint #2 74.30 1,218,004 558 74.96
Java -Xint #8 94.28 1,163,864 596 95.00
Java -Xint #7 32.90 1,078,312 841 96.85
Java -Xint #4 98.08 1,000,460 846 98.84
Python 3 #2 100.90 271,872 344 100.89
Python 3 #4 33.61 276,992 481 121.96
Python 3 #5 35.49 274,816 669 126.17
Python 3 36.12 276,992 597 127.68
Python 3 #3 52.28 671,872 1247 149.07
Python 3 #8 558.92 798,336 535 558.85
pidigits
source secs mem gz cpu secs
Java -Xint #3 0.83 37,044 770 0.83
* Python 3 #3 1.26 19,312 573 1.26
Java -Xint #2 1.41 39,092 944 1.41
Python 3 #4 4.54 19,312 348 4.54
Java -Xint 183.26 188,632 807 183.38
Python 3 #5   Failed  
regex-redux
source secs mem gz cpu secs
* Python 3 #2 1.35 168,236 1411 2.64
Java -Xint #2 1.61 359,548 2201 3.19
Python 3 8.91 432,220 515 16.44
Java -Xint 555.92 559,068 875 993.20
Java -Xint #6 382.01 1,220,444 746 1,007.09
Java -Xint #3 380.77 564,672 935 1,009.25
Python 3

Python 3.13.0

Java -Xint

java 23 2024-09-17
Java HotSpot(TM) 64-Bit Server VM
(build 23+37-2369,
interpreted mode, sharing)