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.51 10,344 382 3.50 0% 2% 1% 100%
Java 3.12 37,444 938 3.30 2% 5% 98% 4%
regex-redux
source secs mem gz cpu cpu load
Python 3 14.86 439,208 486 27.92 46% 77% 35% 31%
Java 10.38 634,548 929 29.48 70% 64% 69% 82%
reverse-complement
source secs mem gz cpu cpu load
Python 3 2.82 265,428 800 4.18 46% 32% 20% 54%
Java 1.13 199,672 2124 2.76 48% 74% 70% 54%
k-nucleotide
source secs mem gz cpu cpu load
Python 3 84.73 221,028 1937 276.97 97% 93% 91% 91%
Java 8.38 375,988 1802 26.25 73% 97% 70% 74%
binary-trees
source secs mem gz cpu cpu load
Python 3 86.90 451,548 581 306.31 89% 97% 87% 89%
Java 8.58 966,808 835 28.98 86% 84% 90% 81%
fannkuch-redux
source secs mem gz cpu cpu load
Python 3 483.79 51,896 944 1,880.10 97% 94% 100% 99%
Java 15.09 34,764 1282 59.26 99% 98% 98% 100%
n-body
source secs mem gz cpu cpu load
Python 3 787.02 7,744 1181 786.82 0% 1% 0% 100%
Java 22.56 35,208 1424 22.65 99% 1% 1% 1%
spectral-norm
source secs mem gz cpu cpu load
Python 3 188.83 54,524 437 750.46 99% 100% 100% 99%
Java 4.25 36,364 950 16.30 97% 96% 95% 97%
mandelbrot
source secs mem gz cpu cpu load
Python 3 273.43 53,416 686 1,091.35 100% 100% 100% 100%
Java 6.08 77,056 796 23.61 97% 97% 99% 97%
fasta
source secs mem gz cpu cpu load
Python 3 110.91 8,024 977 110.87 100% 1% 1% 1%
Java 2.32 46,816 2457 6.37 61% 60% 96% 60%
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 9
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)