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.741.7428,488594  2% 0% 1% 100%
500,0008.248.2462,500594  0% 0% 1% 100%
5,000,00073.1973.22375,576594  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.10.1 (master/9fd3c7a Thu Sep 11 15:32:17 PDT 2014)
LLVM: yes(3.4svn-mono-mono/e656cac)
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

Fri, 12 Sep 2014 15:23:15 GMT

MAKE:
mv regexdna.csharp-2.csharp regexdna.csharp-2.cs
/usr/local/bin/mcs  -optimize+ -platform:x86 -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