The Computer Language
Benchmarks Game

Scala programs versus Java

by benchmark task performance

pidigits
source secs KB gz cpu cpu load
Scala 2.97 61,272 1125 3.53 33% 3% 73% 11%
Java 3.11 33,364 938 3.20 99% 2% 2% 2%
binary-trees
source secs KB gz cpu cpu load
Scala 11.52 686,532 641 36.29 85% 87% 72% 73%
Java 11.51 622,328 889 40.10 86% 86% 92% 87%
mandelbrot
source secs KB gz cpu cpu load
Scala 7.20 93,120 786 27.97 97% 100% 97% 96%
Java 7.14 88,236 796 27.93 97% 98% 98% 99%
spectral-norm
source secs KB gz cpu cpu load
Scala 4.41 38,900 693 16.56 94% 93% 92% 97%
Java 4.26 32,244 950 16.41 96% 98% 95% 97%
n-body
source secs KB gz cpu cpu load
Scala 23.67 35,236 1358 23.72 0% 100% 1% 0%
Java 22.53 28,212 1430 22.54 100% 7% 1% 1%
fannkuch-redux
source secs KB gz cpu cpu load
Scala 15.23 36,820 1017 59.62 99% 98% 98% 97%
Java 13.65 31,996 1282 53.64 99% 98% 99% 98%
reverse-complement
source secs KB gz cpu cpu load
Scala 1.36 477,268 761 1.80 39% 4% 90% 4%
Java 1.17 345,940 1661 2.42 41% 43% 57% 72%
fasta-redux
source secs KB gz cpu cpu load
Scala 3.14 33,388 1435 3.21 2% 1% 20% 80%
Java 2.53 31,648 1443 2.59 3% 98% 1% 3%
regex-dna
source secs KB gz cpu cpu load
Scala 7.98 466,024 1704 27.87 85% 84% 92% 88%
Java 4.56 667,820 1085 12.16 60% 66% 56% 87%
fasta
source secs KB gz cpu cpu load
Scala 7.35 36,560 1053 7.47 78% 23% 1% 2%
Java 2.20 37,072 2457 6.37 81% 68% 72% 72%
k-nucleotide
source secs KB gz cpu cpu load
Scala 32.40 836,800 1625 120.94 97% 93% 93% 91%
Java 8.10 469,624 1802 25.75 97% 77% 76% 71%
Scala

Scala compiler version 2.11.6 -- Copyright 2002-2013, LAMP/EPFL

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Java

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)