performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
50,000Timed Out  622   

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

Erlang R16B (erts-5.10.1) [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]

 regex-dna Erlang program source code

% The Computer Language Benchmarks Game

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


%%% contributed by Tom Plick

%%% based on Python entry by Dominique Wahli


-module(regexdna).

-compile(inline).
-compile({inline_size, 10000}).

-export([main/1]).


% readall() reads all data from standard input.


readall() ->
    readall([]).
readall(Acc) ->
    In = io:get_chars('', 10000),
    case In of 
        'eof'  ->  lists:append(lists:reverse(Acc)) ;
        _  ->  readall([In | Acc])
    end.



exprs() ->
   ["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"].

substExprs() ->
    [{"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)"}].



numberOfMatches(String, Regex) ->
    {match, Matches} = regexp:matches(String, Regex),
    length(Matches).

printNumberOfMatches(String, Regex) ->
    N = numberOfMatches(String, Regex),
    io:format("~s ~w~n", [Regex, N]).


% subst(String, ListOfRegexes) returns String after each substitution in 

%     ListOfRegexes is performed


subst(String, []) ->
    String;
subst(String, [{Exp, Replacement} | Tail]) ->
    {ok, String2, _} = regexp:gsub(String, Exp, Replacement),
    subst(String2, Tail).



main(_Arg) ->
    Sequence1 = readall(),

    {ok, Sequence2, _} = regexp:gsub(Sequence1, "(>[^\n]*\n)|\n|\r", ""),
    lists:foreach(fun(Regex) -> printNumberOfMatches(Sequence2, Regex) end, exprs()),

    Sequence3 = subst(Sequence2, substExprs()),
    io:format("~n~w~n~w~n~w~n", [length(Sequence1), length(Sequence2), length(Sequence3)]),
    halt(0).

 make, command-line, and program output logs

Tue, 05 Mar 2013 06:14:23 GMT

MAKE:
mv regexdna.erlang regexdna.erl
/usr/local/src/otp_src_R16B_nohipe/bin/erlc regexdna.erl
regexdna.erl:47: Warning: regexp:matches/2: removed in R15; use the re module instead
regexdna.erl:61: Warning: regexp:gsub/3: removed in R15; use the re module instead
regexdna.erl:69: Warning: regexp:gsub/3: removed in R15; use the re module instead
rm regexdna.erl
0.48s to complete and log all make actions

COMMAND LINE:
/usr/local/src/otp_src_R16B_nohipe/bin/erl  -smp enable -noshell -run -noinput -run regexdna main 0 < regexdna-input50000.txt

TIMED OUT after 600s


PROGRAM OUTPUT:

Revised BSD license

  Home   Conclusions   License   Play