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.36 112,052 1403 2.64 40% 88% 32% 33%
Java 5.70 656,328 929 18.25 89% 76% 79% 75%
pidigits
source secs mem gz busy cpu load
Python 3 1.28 12,336 567 1.30 1% 0% 1% 100%
Java 0.79 35,568 764 0.84 99% 3% 3% 1%
reverse-complement
source secs mem gz busy cpu load
Python 3 7.16 1,005,968 814 10.65 20% 53% 47% 29%
Java 1.54 702,332 2183 3.55 78% 46% 49% 57%
k-nucleotide
source secs mem gz busy cpu load
Python 3 46.37 239,472 1967 176.69 94% 95% 98% 94%
Java 5.00 408,040 1812 16.36 74% 81% 86% 86%
binary-trees
source secs mem gz busy cpu load
Python 3 49.35 278,628 589 174.26 95% 86% 86% 86%
Java 2.50 2,487,096 835 7.90 88% 75% 75% 79%
fasta
source secs mem gz busy cpu load
Python 3 39.10 846,628 1947 70.52 43% 8% 61% 69%
Java 1.20 44,124 2543 3.61 79% 86% 69% 65%
fannkuch-redux
source secs mem gz busy cpu load
Python 3 367.49 12,288 950 1,454.68 100% 98% 99% 98%
Java 11.00 34,104 1282 43.42 99% 98% 98% 99%
mandelbrot
source secs mem gz busy cpu load
Python 3 172.58 12,216 688 689.62 100% 100% 100% 100%
Java 4.11 68,204 796 16.20 98% 99% 98% 99%
spectral-norm
source secs mem gz busy cpu load
Python 3 118.40 22,912 407 470.86 99% 99% 99% 100%
Java 1.68 38,348 950 6.43 96% 96% 96% 95%
n-body
source secs mem gz busy cpu load
Python 3 586.17 8,012 1196 589.84 0% 0% 0% 100%
Java 6.75 35,200 1489 6.83 0% 0% 100% 1%
Python 3

Python 3.9.0

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)