performance measurements

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

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
50,0000.260.26476456  7% 0% 4% 96%
500,0000.870.8890,896456  95% 1% 6% 1%
5,000,0007.057.05251,148456  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

HipHop VM 3.3.0 (rel)
Compiler: tags/HHVM-3.3.0-0-g0a3cfb87b8a353fc7e1d15374f4adc413e37aba9
Repo schema: 9a391d9a03e15fccba1cde6d35c05b7cdd380238
Extension API: 20140829

 regex-dna Hack #3 program source code

<?hh
#
# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# contributed by Danny Sauer
# modified by Josh Goldfoot
# modified by Sergey Khripunov
# PHP as HHVM/Hack by Isaac Gouy

# regexp matches

#ini_set("memory_limit","40M");

$variants = array(
    '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',
);

# IUB replacement parallel arrays
$IUB = array(); $IUBnew = array();
$IUB[]='/B/S';     $IUBnew[]='(c|g|t)';
$IUB[]='/D/S';     $IUBnew[]='(a|g|t)';
$IUB[]='/H/S';     $IUBnew[]='(a|c|t)';
$IUB[]='/K/S';     $IUBnew[]='(g|t)';
$IUB[]='/M/S';     $IUBnew[]='(a|c)';
$IUB[]='/N/S';     $IUBnew[]='(a|c|g|t)';
$IUB[]='/R/S';     $IUBnew[]='(a|g)';
$IUB[]='/S/S';     $IUBnew[]='(c|g)';
$IUB[]='/V/S';     $IUBnew[]='(a|c|g)';
$IUB[]='/W/S';     $IUBnew[]='(a|t)';
$IUB[]='/Y/S';     $IUBnew[]='(c|t)';

# sequence descriptions start with > and comments start with ;
#my $stuffToRemove = '^[>;].*$|[\r\n]';
$stuffToRemove = '^>.*$|\n'; # no comments, *nix-format test file...

# read in file
$contents = file_get_contents('php://stdin');
$initialLength = strlen($contents);

# remove things
$contents = preg_replace("/$stuffToRemove/mS", '', $contents);
$codeLength = strlen($contents);

# do regexp counts
foreach ($variants as &$regex){
    print $regex . ' ' . preg_match_all('/'.$regex.'/iS', $contents, $discard). "\n";
}

# do replacements
$contents = preg_replace($IUB, $IUBnew, $contents);

print "\n" .
      $initialLength . "\n" .
      $codeLength . "\n" .
      strlen($contents) . "\n" ;

 make, command-line, and program output logs

Sat, 25 Oct 2014 00:22:36 GMT

MAKE:
/usr/bin/hh_client
No errors!
0.02s to complete and log all make actions

COMMAND LINE:
/usr/bin/hhvm  regexdna.hack-3.hack 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