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± ±
 n-body± ±
 spectral-norm± 1/2
 mandelbrot± ±
 reverse-complement±±±
 pidigits± ±
 binary-trees±±±
 regex-dna±±1/2
 fasta± 1/2
 fasta-redux ±
 Scala used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)±±±±±

± 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 
Scala59.0059.0125,1841017  1% 1% 0% 100%
Java67.4867.5021,4481282  1% 1% 0% 100%
 n-body 
Scala23.8423.8525,0761358  1% 1% 0% 100%
Java24.5024.5219,6361424  1% 0% 1% 100%
 spectral-norm 
Scala16.0016.0123,388404  1% 0% 1% 100%
Java16.3116.3120,440950  1% 1% 0% 100%
 mandelbrot 
Scala27.0427.0695,876786  1% 1% 0% 100%
Java26.9626.9859,240796  1% 0% 0% 100%
 reverse-complement 
Scala1.801.80518,336761  1% 1% 3% 100%
Java1.691.69519,612745  0% 1% 0% 100%
 pidigits 
Scala4.434.4447,1081125  0% 1% 1% 100%
Java4.144.1421,844938  1% 0% 1% 100%
 binary-trees 
Scala17.5917.61516,760494  1% 0% 1% 100%
Java16.4116.44521,176584  0% 1% 1% 100%
 regex-dna 
Scala26.3226.34572,164668  1% 0% 0% 100%
Java22.1222.13564,9521377  2% 1% 1% 100%
 fasta 
Scala6.566.5723,7641053  0% 0% 1% 100%
Java4.934.9327,6682457  0% 1% 0% 100%
 fasta-redux 
Scala3.483.4922,0121435  1% 1% 1% 100%
Java1.931.9321,6681443  3% 1% 1% 100%
 k-nucleotide 
ScalaFailed
Java1.041.0560,7881844  1% 0% 1% 100%

 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