/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this Python 3 program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 50,000 | 0.34 | 0.40 | 30,072 | 478 | 3% 0% 3% 88% |
| 500,000 | 2.74 | 2.80 | 76,672 | 478 | 1% 0% 0% 98% |
| 5,000,000 | 26.66 | 26.78 | 267,572 | 478 | 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.
Python 3.3.1 (default, Apr 11 2013, 12:45:45) [GCC 4.7.2] on linux
# The Computer Language Benchmarks Game # http://shootout.alioth.debian.org/ # contributed by Dominique Wahli # 2to3 # mp by Ahmad Syukri # modified by Justin Peel from sys import stdin from re import sub, findall from multiprocessing import Pool def init(arg): global seq seq = arg def var_find(f): return len(findall(f, seq)) def main(): seq = stdin.read() ilen = len(seq) seq = sub('>.*\n|\n', '', seq) clen = len(seq) pool = Pool(initializer = init, initargs = (seq,)) 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') for f in zip(variants, pool.imap(var_find, variants)): print(f[0], f[1]) subst = { '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)'} for f, r in list(subst.items()): seq = sub(f, r, seq) print() print(ilen) print(clen) print(len(seq)) if __name__=="__main__": main()
Thu, 04 Oct 2012 05:03:43 GMT
MAKE:
mv regexdna.python3 regexdna.py
/usr/local/src/Python-3.3.0/bin/python3.3 -OO -c "from py_compile import compile; compile('regexdna.py')"
0.05s to complete and log all make actions
COMMAND LINE:
/usr/local/src/Python-3.3.0/bin/python3.3 regexdna.py 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