1 : At a glance - Are the Scala programs faster?

Each chart bar shows, for one unidentified benchmark, how much the fastest Scala program used compared to the fastest Java program.

(Memory use is only compared for tasks that require memory to be allocated.)


These are not the only compilers and interpreters. These are not the only programs that could be written. These are not the only tasks that could be solved. These are just 10 tiny examples.

 2 : Approximately - Are the Scala programs faster?

Each table row shows, for one named benchmark, how much the fastest Scala program used compared to the fastest Java program.

(Memory use is only compared for tasks that require memory to be allocated.)

 Scala used what fraction? used how many times more? 
Benchmark Time Memory Code
 fannkuch-redux± ±
 pidigits± ±
 regex-dna±1/2
 spectral-norm± ±
 n-body± ±
 reverse-complement±1/2
 mandelbrot± ±
 fasta-redux± ±
 fasta † 1/2
 binary-trees±1/2
 Scala used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)±±±±±

† possible mismatch - one-core program compared to multi-core program.

± read the measurements and then read the program source code.

 3 : Measurements - Are the Scala programs faster?

These are not the only tasks that could be solved. These are just 10 tiny examples. These are not the only compilers and interpreters. These are not the only programs that could be written.

For each named benchmark, measurements of the fastest Scala program are shown for comparison against measurements of the fastest Java program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 fannkuch-redux 
Scala59.6215.2336,8201017  99% 98% 98% 97%
Java68.6417.4133,0321282  98% 98% 99% 99%
 pidigits 
Scala3.532.9761,2721125  33% 3% 73% 11%
Java3.223.1233,528938  3% 2% 80% 21%
 regex-dna 
Scala27.877.98466,0241704  85% 84% 92% 88%
Java24.708.24761,724929  68% 73% 77% 83%
 spectral-norm 
Scala16.564.4138,900693  94% 93% 92% 97%
Java16.534.2832,696950  96% 96% 96% 99%
 n-body 
Scala23.7223.6735,2361358  0% 100% 1% 0%
Java22.6822.6630,0361424  97% 3% 0% 1%
 reverse-complement 
Scala1.801.36477,268761  39% 4% 90% 4%
Java2.681.27315,2961661  41% 48% 34% 92%
 mandelbrot 
Scala27.977.2093,120786  97% 100% 97% 96%
Java24.246.2788,992796  96% 97% 97% 98%
 fasta-redux 
Scala3.213.1433,3881435  2% 1% 20% 80%
Java2.652.5929,9401443  1% 76% 1% 25%
 fasta 
Scala7.477.3536,5601053  78% 23% 1% 2% †
Java5.602.1939,3682457  58% 72% 66% 61% †
 binary-trees 
Scala19.5313.65518,700494  16% 57% 38% 34%
Java11.543.43445,500919  82% 83% 93% 81%
 k-nucleotide 
ScalaFailed
Java1.600.5835,9121844  90% 68% 58% 63%

† possible mismatch - one-core program compared to multi-core program.

 4 : Are there other Scala programs for these benchmarks?

Remember - those are just the fastest Scala and Java programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for Scala.

Maybe one of those other Scala programs is fastest on a different OS/machine.

 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest Scala and Java programs measured on this OS/machine. Check if there are faster implementations of these benchmark programs for other programming languages.

Maybe one of those other programs is fastest on a different OS/machine.

 Scala : higher-order type-safe programming for jvm 

java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

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

Online book: Programming in Scala pdf

A Scala Tutorial for Java programmers pdf

Home Page: http://scala.epfl.ch/

Download: http://scala.epfl.ch/download/

Revised BSD license

  Home   Conclusions   License   Play