/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this PHP program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 50,000 | 0.35 | 0.35 | 276 | 449 | 0% 3% 0% 100% |
| 500,000 | 3.47 | 3.47 | 16,208 | 449 | 1% 0% 0% 100% |
| 5,000,000 | 34.60 | 34.62 | 223,892 | 449 | 0% 0% 0% 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.
PHP 5.4.11 (cli) (built: Jan 27 2013 11:58:31)
<?php # # The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org/ # # contributed by Danny Sauer # modified by Josh Goldfoot # 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/'; $IUBnew[]='(c|g|t)'; $IUB[]='/D/'; $IUBnew[]='(a|g|t)'; $IUB[]='/H/'; $IUBnew[]='(a|c|t)'; $IUB[]='/K/'; $IUBnew[]='(g|t)'; $IUB[]='/M/'; $IUBnew[]='(a|c)'; $IUB[]='/N/'; $IUBnew[]='(a|c|g|t)'; $IUB[]='/R/'; $IUBnew[]='(a|g)'; $IUB[]='/S/'; $IUBnew[]='(c|g)'; $IUB[]='/V/'; $IUBnew[]='(a|c|g)'; $IUB[]='/W/'; $IUBnew[]='(a|t)'; $IUB[]='/Y/'; $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/m", '', $contents); $codeLength = strlen($contents); # do regexp counts foreach ($variants as $regex){ print $regex . ' ' . preg_match_all("/$regex/i", $contents, $discard). "\n"; } # do replacements $contents = preg_replace($IUB, $IUBnew, $contents); print "\n" . $initialLength . "\n" . $codeLength . "\n" . strlen($contents) . "\n" ; ?>
Mon, 28 Jan 2013 01:37:22 GMT COMMAND LINE: /usr/local/src/php-5.4.11/bin/php -n -d memory_limit=512M regexdna.php-2.php 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