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
 regex-dna±1/2
 pidigits± ±
 n-body± ±
 fannkuch-redux± ±
 mandelbrot± ±
 spectral-norm± ±
 reverse-complement±1/2
 fasta-redux ±
 binary-trees±1/2
 fasta † 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
 regex-dna 
Scala28.078.25451,9121704  92% 84% 83% 83%
Java25.798.80729,244929  77% 80% 72% 66%
 pidigits 
Scala4.513.9053,0921125  29% 7% 53% 29%
Java4.174.0726,324938  3% 3% 4% 96%
 n-body 
Scala23.4523.4028,8321358  1% 1% 100% 1%
Java24.3424.3124,1561424  1% 1% 1% 100%
 fannkuch-redux 
Scala66.0716.8631,8121017  98% 98% 99% 97%
Java67.5617.1325,8041282  100% 98% 99% 98%
 mandelbrot 
Scala27.687.1592,200786  96% 96% 99% 97%
Java27.797.1287,832796  97% 99% 97% 97%
 spectral-norm 
Scala16.404.4034,436693  92% 93% 97% 92%
Java16.534.3026,476950  99% 96% 95% 96%
 reverse-complement 
Scala1.981.52520,732761  46% 2% 36% 49%
Java2.911.44308,0601661  47% 31% 85% 43%
 fasta-redux 
Scala3.503.4124,6561435  82% 3% 20% 2%
Java1.991.9324,5881443  98% 2% 4% 3%
 binary-trees 
Scala19.1613.92513,600494  20% 50% 45% 28%
Java19.645.88513,180926  95% 79% 87% 76%
 fasta 
Scala6.396.2629,4881053  2% 89% 11% 1% †
Java5.901.8231,6002457  80% 83% 80% 82% †
 k-nucleotide 
ScalaFailed
Java1.660.5929,1881844  61% 65% 64% 92%

† 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_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)

Scala compiler version 2.11.6 -- 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