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,0002.722.7428,076624  0% 1% 0% 100%
500,0009.289.2978,100624  0% 2% 1% 100%
5,000,00074.8474.881,392,864624  0% 1% 1% 100%

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 JIT compiler version 3.8.1 (master/0322d96 Wed Aug 13 11:49:57 PDT 2014)
LLVM: yes(3.4svn-mono-mono/e656cac)
GC: sgen

 regex-dna C# Mono program source code

/* The Computer Language Benchmarks Game
   http://benchmarksgame.alioth.debian.org/
 * 
 * contributed by Isaac Gouy */

using System;
using System.Text.RegularExpressions;

class regexdna
{
   static void Main(string[] args){
                   
      // read FASTA sequence
      String sequence = Console.In.ReadToEnd();
      int initialLength = sequence.Length;

      // remove FASTA sequence descriptions and new-lines
      Regex r = new Regex(">.*\n|\n", RegexOptions.Compiled);
      sequence = r.Replace(sequence,"");
      int codeLength = sequence.Length;


      // regex match
      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"
      }; 

      int count;
      foreach (string v in variants){
         count = 0;
         r = new Regex(v, RegexOptions.Compiled);

         for (Match m = r.Match(sequence); m.Success; m = m.NextMatch()) count++;
         Console.WriteLine("{0} {1}", v, count);
      }


      // regex substitution
      IUB[] codes = {
          new IUB("B", "(c|g|t)")
         ,new IUB("D", "(a|g|t)")
         ,new IUB("H", "(a|c|t)")
         ,new IUB("K", "(g|t)")
         ,new IUB("M", "(a|c)")
         ,new IUB("N", "(a|c|g|t)")
         ,new IUB("R", "(a|g)")
         ,new IUB("S", "(c|g)")
         ,new IUB("V", "(a|c|g)")
         ,new IUB("W", "(a|t)")
         ,new IUB("Y", "(c|t)")
      }; 

      foreach (IUB iub in codes) {
         r = new Regex(iub.code, RegexOptions.Compiled);
         sequence = r.Replace(sequence,iub.alternatives);
      }
      Console.WriteLine("\n{0}\n{1}\n{2}", 
         initialLength, codeLength, sequence.Length);
   }


   struct IUB 
   {
      public string code;
      public string alternatives;

      public IUB(string code, string alternatives) {
         this.code = code;
         this.alternatives = alternatives;
      }
   }
}

 make, command-line, and program output logs

Thu, 14 Aug 2014 14:21:50 GMT

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

COMMAND LINE:
/usr/local/bin/mono --llvm --gc=sgen regexdna.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