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 C++ g++ 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 C++ g++ 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
 mandelbrot± ±
 k-nucleotide±±
 pidigits †± 
 fannkuch-redux± ±
 fasta ±
 fasta-redux ±
 spectral-norm ±
 binary-trees±1/2
 regex-dna
 reverse-complement1/3
 n-body ±
 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 C++ g++ program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 mandelbrot 
Scala28.567.42285,580786  96% 96% 98% 96%
C++ g++23.775.9732,3881017  100% 100% 100% 100%
 k-nucleotide 
Scala25.109.23171,4642080  55% 76% 69% 73%
C++ g++24.797.34154,7841252  81% 80% 81% 97%
 pidigits 
Scala3.742.9944,8361125  10% 9% 99% 10% †
C++ g++2.292.301,656682  1% 0% 0% 100% †
 fannkuch-redux 
Scala69.8917.7725,6401017  97% 98% 100% 98%
C++ g++53.3313.631,2641440  100% 98% 99% 94%
 fasta 
Scala6.516.3726,9081053  2% 26% 1% 75%
C++ g++4.234.231,0721286  1% 95% 1% 5%
 fasta-redux 
Scala3.203.1321,3721435  1% 2% 21% 81%
C++ g++1.781.788241474  0% 2% 100% 1%
 spectral-norm 
Scala17.814.6325,420720  100% 95% 95% 95%
C++ g++10.092.544961044  99% 99% 100% 100%
 binary-trees 
Scala24.4414.78397,928494  52% 24% 24% 68%
C++ g++27.048.03357,812892  58% 97% 91% 94%
 regex-dna 
Scala28.228.16422,9361704  96% 80% 87% 85%
C++ g++5.273.55198,920695  9% 49% 69% 26%
 reverse-complement 
Scala2.021.54516,736761  3% 92% 5% 35%
C++ g++1.020.65247,5082275  17% 64% 34% 48%
 n-body 
Scala26.5226.4525,9041358  0% 1% 100% 0%
C++ g++9.359.354321544  98% 1% 3% 1%

† 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 C++ g++ 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 C++ g++ 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"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

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