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
50,000Failed  633   

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

Read regex-dna 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

 regex-dna Scala #3 program source code

// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/

// Contributed by The Anh Tran
// Updated for 2.8 by Rex Kerr

import scala.io.Source
import java.util.regex.Pattern
import scala.collection.immutable.HashMap
import scala.actors.Futures.future

object regexdna {

  def main(args : Array[String]) {

    // load data from stdin
    var input = Source.stdin.mkString
    val init_len = input length

    // strip header & newline
    input = ">.*\n|\n".r replaceAllIn(input, "")
    val strip_len = input length

    // counting patterns
    val patterns  = Array(
      "agggtaaa|tttaccct" ,
      "[cgt]gggtaaa|tttaccc[acg]",
      "a[act]ggtaaa|tttacc[agt]t",
      "ag[act]gtaaa|tttac[agt]ct",
      "agg[act]taaa|ttta[agt]cct",
      "aggg[acg]aaa|ttt[cgt]ccct",
      "agggt[cgt]aa|tt[acg]accct",
      "agggta[cgt]a|t[acg]taccct",
      "agggtaa[cgt]|[acg]ttaccct")

    // queue tasks, each task is handled in a separate thread
    val count_results  = patterns map( pt => 
      future(pt.r.findAllIn(input).toArray.length)
    )

    // replace IUB
    val replace_result  = future {
      val iub = HashMap(
        'B' -> "(c|g|t)",
        'D' -> "(a|g|t)",
        'H' -> "(a|c|t)",
        'K' -> "(g|t)",
        'M' -> "(a|c)",
        'N' -> "(a|c|g|t)",
        'R' -> "(a|g)",
        'S' -> "(c|g)",
        'V' -> "(a|c|g)",
        'W' -> "(a|t)",
        'Y' -> "(c|t)"  )

      val buffer  = new StringBuffer((input.length * 3) / 2)
      val matcher  = Pattern compile "[BDHKMNRSVWY]" matcher input

      while ( matcher find )
        matcher appendReplacement( buffer, iub(input(matcher start))  )

      matcher appendTail buffer
      buffer length
    }


    // print results
    for ((pt, cres) <- patterns zip count_results)
      printf( "%s %d\n", pt, cres() )

    printf( "\n%d\n%d\n%d\n", init_len, strip_len, replace_result() )
  }
}

 make, command-line, and program output logs

Wed, 19 Mar 2014 02:44:09 GMT

MAKE:
mv regexdna.scala-3.scala regexdna.scala
/usr/local/src/scala-2.10.3/bin/scalac -optimise -target:jvm-1.7 regexdna.scala
warning: there were 5 feature warning(s); re-run with -feature for details
warning: there were 5 inliner warning(s); re-run with -Yinline-warnings for details
two warnings found
5.20s to complete and log all make actions

COMMAND LINE:
env JAVA_OPTS=-Xmx1024m /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 regexdna 0 < regexdna-input50000.txt

PROGRAM FAILED 


PROGRAM OUTPUT:

Exception in thread "main" java.lang.NoClassDefFoundError: scala/actors/Future
	at regexdna$.main(regexdna.scala:37)
	at regexdna.main(regexdna.scala)
Caused by: java.lang.ClassNotFoundException: scala.actors.Future
	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 2 more

Revised BSD license

  Home   Conclusions   License   Play