The Computer Language
Benchmarks Game

Python 3 programs versus Java

by benchmark task performance

pidigits
source secs KB gz cpu cpu load
Python 3 3.41 9,992 382 3.40 1% 2% 100% 1%
Java 3.06 31,088 938 3.16 0% 3% 9% 92%
regex-dna
source secs KB gz cpu cpu load
Python 3 10.14 258,956 478 23.14 48% 77% 64% 41%
Java 4.26 667,416 1085 11.69 59% 69% 90% 59%
reverse-complement
source secs KB gz cpu cpu load
Python 3 2.93 265,636 800 4.28 80% 46% 21% 2%
Java 1.11 345,308 1661 2.44 33% 58% 54% 80%
k-nucleotide
source secs KB gz cpu cpu load
Python 3 72.35 229,040 1937 268.72 98% 94% 91% 94%
Java 8.02 467,004 1802 25.57 76% 98% 73% 74%
binary-trees
source secs KB gz cpu cpu load
Python 3 126.07 831,740 596 474.55 93% 93% 93% 99%
Java 11.52 643,924 889 40.54 89% 92% 85% 89%
fannkuch-redux
source secs KB gz cpu cpu load
Python 3 501.72 54,708 944 1,967.92 98% 97% 100% 99%
Java 17.74 30,048 1282 69.90 98% 98% 100% 99%
n-body
source secs KB gz cpu cpu load
Python 3 836.27 7,756 1181 836.06 0% 1% 1% 100%
Java 21.50 27,240 1489 21.52 1% 1% 100% 0%
spectral-norm
source secs KB gz cpu cpu load
Python 3 180.01 55,892 437 714.86 99% 100% 99% 100%
Java 4.29 31,428 950 16.56 97% 96% 98% 97%
mandelbrot
source secs KB gz cpu cpu load
Python 3 250.62 52,752 686 1,000.26 100% 100% 100% 100%
Java 5.89 89,504 796 23.08 98% 98% 98% 99%
fasta
source secs KB gz cpu cpu load
Python 3 113.03 7,860 977 112.99 1% 100% 0% 1%
Java 2.14 36,192 2457 5.68 71% 58% 62% 77%
Python 3

Python 3.6.0 (default, Feb 5 2017, 10:29:14) [GCC 5.4.0 20160609] on linux
--enable-optimizations
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)