The Computer Language
Benchmarks Game

Python 3 programs versus Java

by benchmark task performance

regex-redux
source secs mem gz cpu cpu load
Python 3 14.86 439,208 486 27.92 46% 77% 35% 31%
Java 12.31 902,528 929 38.75 73% 76% 86% 81%
reverse-complement
source secs mem gz cpu cpu load
Python 3 2.82 265,428 800 4.18 46% 32% 20% 54%
Java 1.10 345,352 1661 2.40 33% 82% 53% 54%
binary-trees
source secs mem gz cpu cpu load
Python 3 86.90 451,548 581 306.31 89% 97% 87% 89%
Java 11.26 593,156 835 39.02 85% 88% 90% 88%
k-nucleotide
source secs mem gz cpu cpu load
Python 3 84.73 221,028 1937 276.97 97% 93% 91% 91%
Java 7.93 465,372 1802 25.11 75% 75% 75% 93%
fannkuch-redux
source secs mem gz cpu cpu load
Python 3 483.79 51,896 944 1,880.10 97% 94% 100% 99%
Java 13.74 30,368 1282 54.12 100% 98% 98% 99%
n-body
source secs mem gz cpu cpu load
Python 3 787.02 7,744 1181 786.82 0% 1% 0% 100%
Java 21.54 27,092 1489 21.56 1% 1% 100% 1%
mandelbrot
source secs mem gz cpu cpu load
Python 3 273.43 53,416 686 1,091.35 100% 100% 100% 100%
Java 7.10 90,588 796 27.92 99% 99% 98% 98%
spectral-norm
source secs mem gz cpu cpu load
Python 3 188.83 54,524 437 750.46 99% 100% 100% 99%
Java 4.29 29,884 950 16.56 96% 97% 99% 95%
fasta
source secs mem gz cpu cpu load
Python 3 110.91 8,024 977 110.87 100% 1% 1% 1%
Java 2.13 36,036 2457 5.66 94% 58% 59% 60%
pidigits
source secs mem gz cpu cpu load
Python 3   Failed
Java 0.23 784 938 0.24 48% 57% 9% 9%
Python 3

Python 3.6.1 (default, Apr 18 2017, 10:33:41)
[GCC 6.3.0 20170406]
--enable-optimizations --with-lto
make profile-opt

Java

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)