vs

 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± ±
 pidigits †± ±
 mandelbrot± ±
 binary-trees±±±
 reverse-complement±1/2
 n-body± ±
 fasta-redux± ±
 regex-dna±±±
 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 
Scala52.1313.3335,1321017  98% 98% 99% 97%
Java70.2517.8127,0481282  98% 99% 99% 99%
 pidigits 
Scala3.632.9856,7721125  10% 6% 100% 9% †
Java3.153.0329,084938  3% 4% 81% 21% †
 mandelbrot 
Scala27.967.1789,680786  97% 97% 100% 97%
Java28.057.1786,152796  98% 97% 98% 99%
 binary-trees 
Scala19.0413.50513,176494  16% 30% 76% 20%
Java18.8413.36511,792603  71% 21% 20% 31%
 reverse-complement 
Scala1.791.34503,168761  6% 3% 90% 40%
Java2.731.25307,7401661  37% 90% 44% 50%
 n-body 
Scala26.5026.4429,8201358  98% 2% 3% 1%
Java22.6422.6225,2321424  1% 2% 1% 97%
 fasta-redux 
Scala3.183.1225,8521435  81% 21% 1% 2%
Java2.632.5725,2721443  2% 77% 2% 24%
 regex-dna 
Scala29.378.47461,3321704  87% 82% 91% 88%
Java22.726.31648,9241410  89% 96% 88% 89%
 fasta 
Scala6.466.3530,7201053  6% 94% 1% 3% †
Java5.782.1633,6402457  84% 59% 61% 66% †
 spectral-norm 
Scala16.8016.7234,896404  1% 0% 1% 100% †
Java17.604.5525,696950  96% 96% 97% 98% †
 k-nucleotide 
ScalaFailed
Java1.530.5340,7841844  60% 92% 69% 70%

† 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