/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.341.3623,796638  2% 0% 0% 99%
500,0008.308.3250,760638  0% 0% 1% 100%
5,000,00076.6376.67260,496638  0% 0% 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.2.3 (tarball Wed Oct 30 12:15:41 PDT 2013)
LLVM: yes(3.3svn-mono-mono/8bdedb5)
GC: sgen

 regex-dna C# Mono #6 program source code

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

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

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"
        };

        var flags = variants.Select((v, i) => {
            var flag = new ManualResetEvent(false);
            ThreadPool.QueueUserWorkItem(x => {
                variants[i] += " " + Regex.Matches(sequence, v).Count;
                flag.Set();
            });
            return flag;
        });
        WaitHandle.WaitAll(flags.ToArray());
        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]").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

Thu, 31 Oct 2013 02:02:43 GMT

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

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