The Computer Language
Benchmarks Game

Scala programs versus Java

by benchmark task performance

fannkuch-redux
source secs mem gz cpu cpu load
Scala 16.81 47,716 1017 65.32 96% 99% 97% 98%
Java 17.74 30,048 1282 69.90 98% 98% 100% 99%
spectral-norm
source secs mem gz cpu cpu load
Scala 4.62 56,680 693 16.70 90% 87% 97% 89%
Java 4.29 31,428 950 16.56 97% 96% 98% 97%
n-body
source secs mem gz cpu cpu load
Scala 23.88 48,660 1358 23.98 1% 1% 100% 1%
Java 21.50 27,240 1489 21.52 1% 1% 100% 0%
binary-trees
source secs mem gz cpu cpu load
Scala 13.60 531,348 494 19.40 29% 40% 58% 18%
Java 11.52 643,924 889 40.54 89% 92% 85% 89%
mandelbrot
source secs mem gz cpu cpu load
Scala 7.51 104,084 786 28.84 95% 99% 95% 95%
Java 5.89 89,504 796 23.08 98% 98% 98% 99%
reverse-complement
source secs mem gz cpu cpu load
Scala 2.17 382,792 501 2.32 4% 2% 100% 5%
Java 1.11 345,308 1661 2.44 33% 58% 54% 80%
regex-redux
source secs mem gz cpu cpu load
Scala 31.04 800,156 620 33.85 88% 7% 10% 6%
Java 12.16 927,212 929 37.28 73% 81% 75% 78%
fasta
source secs mem gz cpu cpu load
Scala 7.57 47,380 1053 7.74 99% 2% 2% 1%
Java 2.14 36,192 2457 5.68 71% 58% 62% 77%
k-nucleotide
source secs mem gz cpu cpu load
Scala 40.87 976,868 1123 106.81 60% 76% 38% 90%
Java 8.02 467,004 1802 25.57 76% 98% 73% 74%
pidigits
source secs mem gz cpu cpu load
Scala   Failed
Java 0.24 828 938 0.24 71% 38% 8% 4%
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)

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)