The Computer Language
Benchmarks Game

Scala programs versus Python 3

by benchmark task performance

spectral-norm
source secs mem gz cpu cpu load
Scala 4.62 56,680 693 16.70 90% 87% 97% 89%
Python 3 180.01 55,892 437 714.86 99% 100% 99% 100%
n-body
source secs mem gz cpu cpu load
Scala 23.88 48,660 1358 23.98 1% 1% 100% 1%
Python 3 836.27 7,756 1181 836.06 0% 1% 1% 100%
mandelbrot
source secs mem gz cpu cpu load
Scala 7.51 104,084 786 28.84 95% 99% 95% 95%
Python 3 250.62 52,752 686 1,000.26 100% 100% 100% 100%
fannkuch-redux
source secs mem gz cpu cpu load
Scala 16.81 47,716 1017 65.32 96% 99% 97% 98%
Python 3 501.72 54,708 944 1,967.92 98% 97% 100% 99%
fasta
source secs mem gz cpu cpu load
Scala 7.57 47,380 1053 7.74 99% 2% 2% 1%
Python 3 113.03 7,860 977 112.99 1% 100% 0% 1%
binary-trees
source secs mem gz cpu cpu load
Scala 13.60 531,348 494 19.40 29% 40% 58% 18%
Python 3 126.07 831,740 596 474.55 93% 93% 93% 99%
k-nucleotide
source secs mem gz cpu cpu load
Scala 40.87 976,868 1123 106.81 60% 76% 38% 90%
Python 3 72.35 229,040 1937 268.72 98% 94% 91% 94%
reverse-complement
source secs mem gz cpu cpu load
Scala 2.17 382,792 501 2.32 4% 2% 100% 5%
Python 3 2.93 265,636 800 4.28 80% 46% 21% 2%
regex-redux
source secs mem gz cpu cpu load
Scala 31.04 800,156 620 33.85 88% 7% 10% 6%
Python 3 14.87 433,868 486 28.02 32% 45% 84% 29%
pidigits
source secs mem gz cpu cpu load
Scala   Failed
Python 3 0.19 ? 382 0.18 0% 100% 5% 0%
Scala

Scala compiler version 2.12.1 -- Copyright 2002-2016, LAMP/EPFL and Lightbend, Inc.

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)

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