The Computer Language
Benchmarks Game

Scala programs versus Java

by benchmark task performance

fannkuch-redux
source secs KB gz cpu cpu load
Scala 17.29 45,076 1017 67.20 98% 98% 96% 98%
Java 17.34 30,084 1282 68.20 97% 98% 99% 99%
mandelbrot
source secs KB gz cpu cpu load
Scala 7.50 103,940 786 28.86 99% 95% 96% 95%
Java 7.14 88,236 796 27.93 97% 98% 98% 99%
n-body
source secs KB gz cpu cpu load
Scala 23.87 55,032 1358 23.98 1% 1% 100% 1%
Java 22.53 28,212 1430 22.54 100% 7% 1% 1%
spectral-norm
source secs KB gz cpu cpu load
Scala 4.66 55,488 693 16.79 87% 89% 88% 98%
Java 4.26 32,244 950 16.41 96% 98% 95% 97%
binary-trees
source secs KB gz cpu cpu load
Scala 13.71 527,684 494 19.66 21% 53% 30% 42%
Java 11.51 622,328 889 40.10 86% 86% 92% 87%
reverse-complement
source secs KB gz cpu cpu load
Scala 1.51 529,124 761 2.01 37% 91% 0% 7%
Java 1.17 345,940 1661 2.42 41% 43% 57% 72%
regex-dna
source secs KB gz cpu cpu load
Scala 8.20 495,836 1726 28.28 84% 82% 97% 83%
Java 4.56 667,820 1085 12.16 60% 66% 56% 87%
fasta
source secs KB gz cpu cpu load
Scala 7.24 46,360 1053 7.40 12% 89% 3% 1%
Java 2.20 37,072 2457 6.37 81% 68% 72% 72%
k-nucleotide
source secs KB gz cpu cpu load
Scala 40.81 977,616 1123 108.67 83% 34% 89% 62%
Java 8.10 469,624 1802 25.75 97% 77% 76% 71%
pidigits
source secs KB gz cpu cpu load
Scala   Failed
Java 0.26 788 938 0.28 16% 37% 8% 54%
Scala

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

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)

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)