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
 k-nucleotide±1/6±
 regex-dna±1/2
 pidigits †± ±
 fannkuch-redux± ±
 spectral-norm± ±
 binary-trees±±±
 mandelbrot± ±
 reverse-complement±1/2
 n-body± ±
 fasta-redux± ±
 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 : 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
 k-nucleotide 
Scala25.109.23171,4642080  55% 76% 69% 73%
Java34.4410.221,096,5401844  79% 83% 82% 94%
 regex-dna 
Scala28.228.16422,9361704  96% 80% 87% 85%
Java24.528.59707,744929  80% 64% 79% 64%
 pidigits 
Scala3.742.9944,8361125  10% 9% 99% 10% †
Java3.173.0323,504938  19% 80% 5% 3% †
 fannkuch-redux 
Scala69.8917.7725,6401017  97% 98% 100% 98%
Java70.0617.7319,7201282  99% 99% 98% 99%
 spectral-norm 
Scala17.814.6325,420720  100% 95% 95% 95%
Java17.804.5921,132950  97% 96% 99% 96%
 binary-trees 
Scala24.4414.78397,928494  52% 24% 24% 68%
Java24.8914.48390,708584  34% 73% 38% 30%
 mandelbrot 
Scala28.567.42285,580786  96% 96% 98% 96%
Java27.847.1162,344796  98% 97% 98% 100%
 reverse-complement 
Scala2.021.54516,736761  3% 92% 5% 35%
Java2.971.47300,7121661  47% 37% 78% 43%
 n-body 
Scala26.5226.4525,9041358  0% 1% 100% 0%
Java22.9022.8719,5721424  99% 1% 1% 1%
 fasta-redux 
Scala3.203.1321,3721435  1% 2% 21% 81%
Java2.632.5819,9601443  77% 1% 24% 2%
 fasta 
Scala6.516.3726,9081053  2% 26% 1% 75% †
Java5.782.2032,6202457  62% 75% 63% 65% †

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