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/4±
 regex-dna±1/2
 n-body± ±
 pidigits± ±
 spectral-norm± ±
 reverse-complement±1/2
 mandelbrot± ±
 binary-trees±±±
 fannkuch-redux± ±
 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 
Scala30.2511.00209,6602080  74% 87% 54% 60%
Java45.3313.06923,0681630  81% 83% 85% 99%
 regex-dna 
Scala30.338.78461,4121704  86% 82% 96% 83%
Java26.449.20713,236929  80% 66% 77% 65%
 n-body 
Scala23.5523.5019,8561358  1% 99% 1% 1%
Java24.5024.4815,6561424  0% 100% 1% 0%
 pidigits 
Scala4.593.9142,3641125  65% 6% 39% 9%
Java4.154.0418,352938  16% 84% 1% 1%
 spectral-norm 
Scala16.614.3519,928720  94% 95% 99% 94%
Java16.564.2916,460950  96% 96% 99% 96%
 reverse-complement 
Scala2.201.69512,996761  92% 6% 33% 2%
Java3.161.63296,1361661  77% 24% 39% 58%
 mandelbrot 
Scala28.457.36201,012786  96% 96% 99% 97%
Java27.176.9573,488796  97% 97% 99% 98%
 binary-trees 
Scala18.5813.84480,552494  71% 13% 13% 39%
Java17.7512.78471,136584  77% 15% 15% 34%
 fannkuch-redux 
Scala73.8918.7519,8201017  99% 99% 100% 97%
Java68.0417.2515,6961282  99% 99% 97% 99%
 fasta-redux 
Scala3.443.3717,1281435  1% 1% 2% 100%
Java2.031.9815,8961443  82% 19% 2% 2%
 fasta 
Scala6.526.4120,3721053  91% 1% 11% 1% †
Java5.341.7229,4842457  69% 75% 73% 96% †

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