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.


java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Scala compiler version 2.11.6 -- Copyright 2002-2013, LAMP/EPFL

 regex-dna Scala #3 program source code

// The Computer Language Benchmarks Game

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

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" ,

    // queue tasks, each task is handled in a separate thread
    val count_results  = patterns map( pt => 

    // 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, 20 May 2015 00:40:25 GMT

mv regexdna.scala-3.scala regexdna.scala
/usr/local/src/scala-2.11.6/bin/scalac -optimise -target:jvm-1.8 regexdna.scala
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
warning: there were four deprecation warnings; re-run with -deprecation for details
warning: there were 5 feature warnings; re-run with -feature for details
two warnings found
5.17s to complete and log all make actions

env JAVA_OPTS=-Xmx1024m /usr/local/src/jdk1.8.0_45/bin/java -server -XX:+TieredCompilation -XX:+AggressiveOpts  -Xbootclasspath/a:/usr/local/src/scala-2.11.6/lib/scala-library.jar:/usr/local/src/scala-2.11.6/lib/akka-actors.jar:/usr/local/src/scala-2.11.6/lib/typesafe-config.jar regexdna 0 < regexdna-input50000.txt



Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
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.lang.ClassLoader.loadClass(
	at sun.misc.Launcher$AppClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	... 2 more

Revised BSD license

  Home   Conclusions   License   Play