The Computer Language
Benchmarks Game

Python 3 versus Java fastest programs

Always look at the source code.

These are only the fastest programs. Look at the other programs. They may seem more-like a fair comparison to you.

regex-redux
source secs mem gz busy cpu load
Python 3 1.37 404,320 1403 2.65 32% 41% 33% 88%
Java 5.75 647,984 929 18.61 82% 88% 77% 77%
pidigits
source secs mem gz busy cpu load
Python 3 1.29 11,976 567 1.30 0% 100% 1% 0%
Java 0.94 36,644 764 1.07 98% 5% 2% 9%
reverse-complement
source secs mem gz busy cpu load
Python 3 7.15 1,005,204 814 10.62 81% 1% 47% 20%
Java 1.58 677,584 2183 3.76 55% 74% 48% 61%
k-nucleotide
source secs mem gz busy cpu load
Python 3 48.51 134,372 1967 185.66 94% 100% 94% 95%
Java 4.57 485,000 1812 14.50 77% 74% 83% 82%
binary-trees
source secs mem gz busy cpu load
Python 3 48.45 448,980 589 171.58 86% 86% 87% 94%
Java 2.48 2,496,112 835 7.88 78% 91% 74% 75%
fasta
source secs mem gz busy cpu load
Python 3 38.07 845,888 1947 75.85 23% 63% 66% 47%
Java 1.27 45,584 2473 3.91 82% 83% 73% 70%
fannkuch-redux
source secs mem gz busy cpu load
Python 3 366.43 47,608 950 1,448.16 100% 99% 100% 97%
Java 10.61 34,960 1282 42.06 99% 99% 99% 98%
mandelbrot
source secs mem gz busy cpu load
Python 3 170.25 47,568 688 680.12 100% 100% 100% 100%
Java 4.14 71,012 796 16.29 99% 99% 98% 98%
spectral-norm
source secs mem gz busy cpu load
Python 3 116.23 50,080 407 463.55 100% 100% 100% 100%
Java 1.57 39,376 756 5.94 96% 94% 95% 95%
n-body
source secs mem gz busy cpu load
Python 3 545.25 8,160 1196 558.88 1% 1% 1% 100%
Java 6.74 36,480 1489 6.84 100% 1% 0% 0%
Python 3

Python 3.8.3

Java

java 14.0.1 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)