/mobile Handheld Friendly website

 performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
50,0001.271.2927,020594  2% 3% 56% 41%
500,0008.078.0753,760594  1% 3% 80% 18%
5,000,00075.0275.04263,052594  0% 16% 69% 16%

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

Mono Runtime Engine version 3.2.5 (master/4c1198f Tue Oct 29 09:53:35 PDT 2013)
LLVM: yes(3.3svn-mono-mono/8bdedb5)
GC: sgen

 regex-dna C# Mono #2 program source code

/* The Computer Language Benchmarks Game

   http://benchmarksgame.alioth.debian.org/

 *

 * contributed by Jimmy Tang

 * modified by Sindhudweep Narayan Sarkar

*/

using System;
using System.Linq;
using System.Threading;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

class regexdna {
   static void Main() {
      string sequence = Console.In.ReadToEnd();
      int initialLength = sequence.Length;
            
      sequence = Regex.Replace(sequence, ">.*\n|\n", "");
      int codeLength = sequence.Length;
      
      string[] variants = {
      "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"
      };
      
      Parallel.For(0, variants.Length, i => 
         { 
            var pattern = new Regex(variants[i], RegexOptions.Compiled); 
            variants[i] += " " + pattern.Matches(sequence).Count; 
         });
      Console.WriteLine(string.Join("\n", variants));
      
      var dict = new Dictionary<string, string> {
         {"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)"} 
      };
      sequence = new Regex("[WYKMSRBDVHN]", RegexOptions.Compiled).Replace(sequence, m => dict[m.Value]);
      Console.WriteLine("\n{0}\n{1}\n{2}", initialLength, codeLength, sequence.Length);
   }
}

 make, command-line, and program output logs

Tue, 29 Oct 2013 22:40:20 GMT

MAKE:
mv regexdna.csharp-2.csharp regexdna.csharp-2.cs
/usr/local/bin/mcs  -optimize+ -platform:x64 -out:regexdna.csharp-2.csharp_run regexdna.csharp-2.cs
rm regexdna.csharp-2.cs
0.24s to complete and log all make actions

COMMAND LINE:
/usr/local/bin/mono --llvm --gc=sgen regexdna.csharp-2.csharp_run 0 < regexdna-input5000000.txt

PROGRAM OUTPUT:
agggtaaa|tttaccct 356
[cgt]gggtaaa|tttaccc[acg] 1250
a[act]ggtaaa|tttacc[agt]t 4252
ag[act]gtaaa|tttac[agt]ct 2894
agg[act]taaa|ttta[agt]cct 5435
aggg[acg]aaa|ttt[cgt]ccct 1537
agggt[cgt]aa|tt[acg]accct 1431
agggta[cgt]a|t[acg]taccct 1608
agggtaa[cgt]|[acg]ttaccct 2178

50833411
50000000
66800214

Revised BSD license

  Home   Conclusions   License   Play