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 OCaml 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 OCaml 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
 mandelbrot1/2 ±
 binary-trees1/21/2
 fannkuch-redux± ±
 regex-dna±
 fasta± ±
 pidigits †± 
 n-body± ±
 reverse-complement16×1/2
 spectral-norm † 1/2
 Scala used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/21/2±±±

† 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 OCaml program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 mandelbrot 
Scala27.967.1789,680786  97% 97% 100% 97%
OCaml54.8913.785,492710  100% 100% 100% 100%
 binary-trees 
Scala19.0413.50513,176494  16% 30% 76% 20%
OCaml70.9124.46202,980784  72% 75% 58% 86%
 fannkuch-redux 
Scala52.1313.3335,1321017  98% 98% 99% 97%
OCaml0.0116.2522,3081017  100% 100% 100% 100%
 regex-dna 
Scala29.378.47461,3321704  87% 82% 91% 88%
OCaml1.399.43268,4801050  83% 83% 83% 100%
 fasta 
Scala6.466.3530,7201053  6% 94% 1% 3%
OCaml6.046.05200,8721161  1% 1% 100% 0%
 pidigits 
Scala3.632.9856,7721125  10% 6% 100% 9% †
OCaml2.832.839,192560  1% 0% 0% 100% †
 n-body 
Scala26.5026.4429,8201358  98% 2% 3% 1%
OCaml22.2622.277081239  1% 0% 100% 1%
 reverse-complement 
Scala1.791.34503,168761  6% 3% 90% 40%
OCaml0.000.7331,4361314  47% 47% 52% 70%
 spectral-norm 
Scala16.8016.7234,896404  1% 0% 1% 100% †
OCaml16.024.313,496938  93% 94% 93% 92% †
 k-nucleotide 
ScalaFailed
OCaml0.710.2839,4601789  82% 90% 50% 39%
 fasta-redux 
Scala0.220.19?1435  90% 11% 6% 6%
No program

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