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

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 : Are the Scala programs faster? Approximately.

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± ±
 regex-dna±1/2
 n-body± ±
 pidigits± ±
 mandelbrot± ±
 reverse-complement±1/2
 binary-trees±±±
 fasta-redux ±
 fasta † 1/2
 spectral-norm † 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 : Are the Scala programs faster? Measurements.

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 
Scala60.3615.4223,1041017  98% 97% 98% 98%
Java64.3816.3319,9081282  98% 100% 98% 99%
 regex-dna 
Scala29.818.54446,2401704  90% 86% 89% 85%
Java26.349.02714,924929  64% 75% 86% 67%
 n-body 
Scala23.4923.4322,8521358  1% 1% 1% 100%
Java24.4724.4519,5081424  1% 1% 100% 0%
 pidigits 
Scala4.543.9045,4681125  57% 10% 45% 6%
Java4.154.0423,488938  2% 2% 0% 100%
 mandelbrot 
Scala27.497.0885,596786  96% 99% 97% 97%
Java27.036.9181,940796  98% 99% 97% 98%
 reverse-complement 
Scala1.871.41518,472761  1% 39% 3% 91%
Java2.671.36306,1561661  81% 33% 38% 47%
 binary-trees 
Scala20.8314.40485,116494  46% 16% 39% 46%
Java18.8013.20476,640584  38% 37% 32% 37%
 fasta-redux 
Scala3.453.3722,2841435  3% 100% 1% 2%
Java1.921.8719,7921443  2% 2% 2% 99%
 fasta 
Scala6.506.3923,7081053  5% 97% 2% 1% †
Java5.231.7329,1042457  70% 68% 95% 70% †
 spectral-norm 
Scala16.0515.9721,408404  1% 1% 99% 2% †
Java16.564.3020,064950  95% 96% 99% 96% †
 k-nucleotide 
ScalaFailed
Java1.340.4930,0921844  78% 63% 65% 67%

† 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) 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