performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
50,0000.050.05?648  0% 100% 0% 17%
500,0000.520.5215,648648  0% 4% 0% 100%
5,000,0005.235.23208,580648  2% 100% 1% 1%

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

gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

 regex-dna C++ g++ program source code

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

   contributed by Alexey Zolotov
   without openmp, without assert
*/

#include <re2.h>
#include <iostream>
#include <stdio.h>

using namespace re2;
using namespace std;

#define BUFSIZE 1024

int main(void)
{
    string str, out;
    int len1, len2;
    int read_size;
    char *buf;

    string pattern1[] = {
        "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"
    };

    string pattern2[] = {
        "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)"
    };


    fseek(stdin, 0, SEEK_END);
    read_size = ftell(stdin);

    buf = new char[read_size];
    rewind(stdin);
    read_size = fread(buf, 1, read_size, stdin);

    str.append(buf, read_size);

    delete [] buf;

    len1 = str.length();
    RE2::GlobalReplace(&str, ">.*\n|\n", "");
    len2 = str.length();

    out = str;

    {
        for (int i = 0; i < (int)(sizeof(pattern1) / sizeof(string)); i++) {
            int count = 0;
            RE2 pat(pattern1[i]);
            StringPiece piece = str;

            while (RE2::FindAndConsume(&piece, pat)) {
                count++;
            }

            cout << pattern1[i] << " " << count << endl;
        }

        for (int i = 0; i < (int)(sizeof(pattern2) / sizeof(string)); i += 2) {
            RE2::GlobalReplace(&out, pattern2[i], pattern2[i + 1]);
        }
    }

    cout << endl;
    cout << len1 << endl;
    cout << len2 << endl;
    cout << out.length() << endl;

}

 make, command-line, and program output logs

Tue, 22 Apr 2014 00:14:46 GMT

MAKE:
/usr/bin/g++ -c -pipe -O3 -fomit-frame-pointer -march=native  -fopenmp -I/usr/local/src/re2/re2 regexdna.c++ -o regexdna.c++.o &&  \
        /usr/bin/g++ regexdna.c++.o -o regexdna.gpp_run /usr/local/src/re2/obj/libre2.a -fopenmp 
rm regexdna.c++
0.57s to complete and log all make actions

COMMAND LINE:
./regexdna.gpp_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