/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one 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 |
|---|---|---|---|---|---|
| 12 | Failed | 641 |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read binary-trees 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 Kannan Goundan modified by Isaac Gouy optimized by David Pollak updated for 2.8 and parallelized by Rex Kerr */ import scala.actors.Futures._ object binarytrees { def report(name: String, depth: Int, check: Int) = println(name + " of depth " + depth + "\t check: " + check) def main(args: Array[String]) = { val n = try{ args(0).toInt } catch { case _ => 1 } val minDepth = 4 val maxDepth = n max (minDepth+2) val threads = 3 // More than 3 tends to overwhelm GC report("stretch tree", maxDepth+1, Tree(0,maxDepth+1).isum) val longLivedTree = Tree(0,maxDepth) var depth = minDepth while (depth <= maxDepth) { val iterations = 1 << (maxDepth - depth + minDepth) val limits = (0 to threads).map(_*iterations/threads).sliding(2).toList val check = limits.map(i => future(Go(i(0)+1,i(1),depth).calc)) report(iterations*2 + "\t trees", depth, check.map(_()).sum) depth += 2 } report("long lived tree", maxDepth, longLivedTree.isum) } } case class Sum(var sum: Int) { def +=(i: Int) = { sum+=i; this } } case class Go(i0: Int, i1: Int, depth: Int) { def calc = (Sum(0) /: (i0 to i1))((s,i) => s += Tree(i,depth).isum + Tree(-i,depth).isum ).sum } final class Tree(i: Int, left: Tree, right: Tree) { def isum: Int = if (left eq null) i else i + left.isum - right.isum } object Tree { def apply(i: Int, depth: Int): Tree = { if (depth > 0) new Tree(i, Tree(i*2-1, depth-1), Tree(i*2, depth-1)) else new Tree(i, null, null) } }
Sat, 26 Jan 2013 13:49:38 GMT
MAKE:
mv binarytrees.scala-2.scala binarytrees.scala
/usr/local/src/scala-2.10.0/bin/scalac -optimise -target:jvm-1.7 binarytrees.scala
binarytrees.scala:17: warning: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning.
val n = try{ args(0).toInt } catch { case _ => 1 }
^
one warning found
6.45s 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 binarytrees 12
PROGRAM FAILED
PROGRAM OUTPUT:
stretch tree of depth 13 check: -1
Exception in thread "main" java.lang.NoClassDefFoundError: scala/actors/Futures$
at binarytrees$$anonfun$2.apply(binarytrees.scala:28)
at binarytrees$$anonfun$2.apply(binarytrees.scala:28)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:309)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at binarytrees$.main(binarytrees.scala:28)
at binarytrees.main(binarytrees.scala)
Caused by: java.lang.ClassNotFoundException: scala.actors.Futures$
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 9 more