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.58 656,192 929 17.84 83% 83% 80% 74%
pidigits
source secs mem gz busy cpu load
Python 3 1.29 11,976 567 1.30 0% 100% 1% 0%
Java 0.94 35,604 764 0.99 1% 4% 3% 97%
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.53 720,672 2183 3.57 52% 63% 59% 59%
k-nucleotide
source secs mem gz busy cpu load
Python 3 48.51 134,372 1967 185.66 94% 100% 94% 95%
Java 4.88 409,508 1812 15.86 75% 88% 86% 77%
binary-trees
source secs mem gz busy cpu load
Python 3 48.39 278,240 589 171.39 87% 88% 94% 86%
Java 2.49 2,490,296 835 7.88 92% 75% 78% 72%
fasta
source secs mem gz busy cpu load
Python 3 38.07 845,888 1947 75.85 23% 63% 66% 47%
Java 1.28 44,172 2473 4.17 83% 78% 88% 76%
fannkuch-redux
source secs mem gz busy cpu load
Python 3 366.43 47,608 950 1,448.16 100% 99% 100% 97%
Java 9.94 34,188 1282 39.21 99% 98% 99% 97%
mandelbrot
source secs mem gz busy cpu load
Python 3 170.25 47,568 688 680.12 100% 100% 100% 100%
Java 4.15 70,040 796 16.34 98% 98% 99% 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.66 38,280 950 6.36 97% 95% 96% 96%
n-body
source secs mem gz busy cpu load
Python 3 545.25 8,160 1196 558.88 1% 1% 1% 100%
Java 6.76 35,156 1489 6.83 1% 0% 100% 1%
Python 3

Python 3.8.3

Java

openjdk 15 2020-09-15
OpenJDK Runtime Environment (build 15+36-1562)
OpenJDK 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)