performance measurements

Each table row shows performance measurements for this Scala program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1,0000.390.37688454  11% 3% 3% 95%
4,0003.463.4121,556454  2% 2% 18% 82%
16,00051.8951.8023,796454  1% 1% 4% 97%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read mandelbrot benchmark to see what this program should do.

 notes

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

 mandelbrot Scala #2 program source code

/* The Computer Language Benchmarks Game
   http://benchmarksgame.alioth.debian.org/
   contributed by Isaac Gouy
*/

import java.io.BufferedOutputStream

object mandelbrot { 
   def main(args: Array[String]) = {
      val side = Integer.parseInt(args(0))
      val limitSquared = 4.0
      val max = 50
      var bits = 0
      var bitnum = 0
      val w = new BufferedOutputStream(System.out)

      Console.println("P4\n" + side + " " + side)

      var y = 0
      while (y < side){

         var x = 0
         while (x < side){

            val cr = 2.0 * x / side - 1.5
            val ci = 2.0 * y / side - 1.0

            var zr = 0.0; var zi = 0.0
            var tr = 0.0; var ti = 0.0

            var j = max
            do {
               zi = 2.0 * zr * zi + ci
               zr = tr - ti + cr
               ti = zi*zi
               tr = zr*zr

               j = j - 1
            } while (!(tr + ti > limitSquared) && j > 0)


            bits = bits << 1
            if (!(tr + ti > limitSquared)) bits = bits + 1
            bitnum = bitnum + 1

            if (x == side - 1){
               bits = bits << (8 - bitnum)
               bitnum = 8
            }

            if (bitnum == 8){
               w.write(bits.toByte)
               bits = 0
               bitnum = 0
            }

            x = x + 1
         }
         y = y + 1
      }
      w.close
   } 
}

 make, command-line, and program output logs

Wed, 19 Mar 2014 02:30:15 GMT

MAKE:
mv mandelbrot.scala-2.scala mandelbrot.scala
/usr/local/src/scala-2.10.3/bin/scalac -optimise -target:jvm-1.7 mandelbrot.scala
2.88s to complete and log all make actions

COMMAND LINE:
 /usr/local/src/jdk1.8.0/bin/java -server -XX:+TieredCompilation -XX:+AggressiveOpts  -Xbootclasspath/a:/usr/local/src/scala-2.10.3/lib/scala-library.jar:/usr/local/src/scala-2.10.3/lib/akka-actors.jar:/usr/local/src/scala-2.10.3/lib/typesafe-config.jar mandelbrot 16000

(BINARY) PROGRAM OUTPUT NOT SHOWN

Revised BSD license

  Home   Conclusions   License   Play