The Computer Language
Benchmarks Game

Python 3 programs versus Java

by benchmark task performance

pidigits
source secs mem gz cpu cpu load
Python 3 3.43 12,716 386 3.43 100% 1% 1% 0%
Java 3.12 36,788 938 3.31 6% 3% 4% 96%
regex-redux
source secs mem gz cpu cpu load
Python 3 15.22 447,324 512 27.44 25% 33% 32% 91%
Java 10.34 627,224 929 29.88 74% 72% 65% 79%
reverse-complement
source secs mem gz cpu cpu load
Python 3 3.26 264,596 814 4.67 18% 99% 1% 26%
Java 1.03 191,064 2183 2.31 52% 57% 43% 74%
k-nucleotide
source secs mem gz cpu cpu load
Python 3 77.65 182,700 1967 302.86 97% 99% 97% 98%
Java 8.70 375,568 1812 27.17 80% 72% 74% 88%
binary-trees
source secs mem gz cpu cpu load
Python 3 93.55 280,624 589 337.74 92% 89% 87% 93%
Java 8.34 893,008 835 28.20 87% 79% 96% 81%
fasta
source secs mem gz cpu cpu load
Python 3 59.47 15,996 1947 138.97 55% 55% 63% 66%
Java 2.33 43,924 2473 6.07 53% 71% 63% 74%
fannkuch-redux
source secs mem gz cpu cpu load
Python 3 565.97 15,528 950 2,172.63 95% 94% 95% 100%
Java 17.26 32,116 1282 67.75 98% 99% 97% 99%
mandelbrot
source secs mem gz cpu cpu load
Python 3 225.24 15,736 688 899.25 100% 100% 100% 100%
Java 6.04 76,528 796 23.34 98% 97% 97% 97%
n-body
source secs mem gz cpu cpu load
Python 3 838.39 10,324 1196 838.20 95% 1% 5% 0%
Java 22.10 33,136 1429 22.20 31% 1% 1% 70%
spectral-norm
source secs mem gz cpu cpu load
Python 3 180.97 15,876 443 720.51 100% 100% 100% 100%
Java 4.23 34,472 950 16.27 96% 97% 97% 96%
Python 3

Python 3.6.3

Java

java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)