/mobile Handheld Friendly website

 performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
50,00022.1822.1960,904648  0% 1% 1% 100%
500,000Timed Out  648   

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

Dart VM version: 1.3.0 (Tue Apr 8 09:38:50 2014) on "linux_x64"

 regex-dna Dart #2 program source code

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

   contributed by Jos Hirth, based on the JavaScript version
     which was created by Jesse Millikan, jose fco. gonzalez, and Matthew Wilson
*/

import 'dart:io';
import 'dart:convert';

void main() {
  var text = new StringBuffer();
  var src = stdin.transform(UTF8.decoder).transform(new LineSplitter());

  src.listen((line) {
    if (line != null) {
      text.write(line);
      text.write('\n');
    }
  },
  onDone: () {
    regexAllTheThings(text.toString());
  });
}

void regexAllTheThings (String fullText) {
  var lengthA, lengthB, lengthC, regexp, replacements;

  regexp = ((){
    var pattern = [
      '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'
    ];
    var regexp = [];
    for(var p in pattern) {
      regexp.add(new RegExp(p, caseSensitive: false));
    }
    return regexp;
  }());

  replacements = [
    '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)'
  ];

  lengthA = fullText.length;

  fullText = fullText.replaceAll(new RegExp('^>.*\n|\n', multiLine: true), ''); // still ridiculously slow with r21658

  lengthB = fullText.length;

  for(var i = 0; i < regexp.length; ++i) {
    print('${regexp[i].pattern} ${regexp[i].allMatches(fullText).length}');
  }

  for(var i = -1; i < replacements.length - 1;) {
    fullText = fullText.replaceAll(replacements[++i], replacements[++i]);
  }

  lengthC = fullText.length;

  print('\n$lengthA\n$lengthB\n$lengthC');
}

 make, command-line, and program output logs

Thu, 17 Apr 2014 04:00:05 GMT

COMMAND LINE:
/usr/local/src/dart-sdk/bin/dart  regexdna.dart-2.dart 0 < regexdna-input500000.txt

TIMED OUT after 300s


PROGRAM OUTPUT:

Revised BSD license

  Home   Conclusions   License   Play