/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® quad-core |
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 |
|---|---|---|---|---|---|
| 500 | 0.42 | 0.37 | 212 | 404 | 5% 3% 14% 97% |
| 3,000 | 5.07 | 5.00 | 17,864 | 404 | 1% 1% 100% 1% |
| 5,500 | 16.53 | 16.23 | 18,188 | 404 | 0% 0% 2% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read spectral-norm benchmark to see what this program should do.
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) Server VM (build 23.6-b04, mixed mode)
Scala compiler version 2.10.0 -- Copyright 2002-2012, LAMP/EPFL
/* The Computer Language Benchmarks Game http://benchmarksgame.alioth.debian.org/ contributed by Isaac Gouy modified by Meiko Rachimow updated for 2.8 by Rex Kerr */ object spectralnorm { def main(args: Array[String]) = { val n = (if (args.length>0) args(0).toInt else 100) printf("%.09f\n", (new SpectralNorm(n)).approximate()) } } class SpectralNorm(n: Int) { // Ordinary and transposed versions of infinite matrix val A = (i: Int, j: Int) => 1.0/((i+j)*(i+j+1)/2 +i+1) val At = (j: Int, i: Int) => 1.0/((i+j)*(i+j+1)/2 +i+1) // Matrix multiplication w <- M*v def mult(v: Array[Double], w: Array[Double], M: (Int,Int)=> Double ) { var i = 0 while (i < n) { var s = 0.0 var j = 0 while (j < n) { s += M(i,j)*v(j); j += 1 } w(i) = s i += 1 } } def approximate() = { val u,v,w = Array.fill(n)(1.0) var i = 0 while (i < 10) { // Multiply by matrix & transpose mult(u,w,A) mult(w,v,At) mult(v,w,A) mult(w,u,At) i += 1 } var vbv,vv = 0.0 i = 0 while (i < n) { vbv += u(i)*v(i) vv += v(i)*v(i) i += 1 } math.sqrt(vbv/vv) } }
Sat, 26 Jan 2013 12:24:22 GMT MAKE: mv spectralnorm.scala spectralnorm.scala mv: `spectralnorm.scala' and `spectralnorm.scala' are the same file make: [spectralnorm.scala_run] Error 1 (ignored) /usr/local/src/scala-2.10.0/bin/scalac -optimise -target:jvm-1.7 spectralnorm.scala 5.30s to complete and log all make actions COMMAND LINE: /usr/local/src/jdk1.7.0_11/bin/java -server -XX:+TieredCompilation -XX:+AggressiveOpts -Xbootclasspath/a:/usr/local/src/scala-2.10.0/lib/scala-library.jar:/usr/local/src/scala-2.10.0/lib/akka-actors.jar:/usr/local/src/scala-2.10.0/lib/typesafe-config.jar spectralnorm 5500 PROGRAM OUTPUT: 1.274224153