Each table row shows performance measurements for this PyPy program with a particular command-line input value N.
N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
---|---|---|---|---|---|
10,000 | 0.27 | 0.28 | 450,056 | 612 | 4% 64% 4% 10% 7% 7% 7% 4% |
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.
# The Computer Language Benchmarks Game # http://shootout.alioth.debian.org/ # contributed by Dominique Wahli # 2to3 # mp by Ahmad Syukri # modified by Justin Peel from __future__ import print_function 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()
Fri, 09 Sep 2022 06:05:40 GMT COMMAND LINE: /usr/bin/pypy regexdna.pypy 0 < regexdna-input10000.txt PROGRAM OUTPUT: agggtaaa|tttaccct 0 [cgt]gggtaaa|tttaccc[acg] 3 a[act]ggtaaa|tttacc[agt]t 9 ag[act]gtaaa|tttac[agt]ct 8 agg[act]taaa|ttta[agt]cct 10 aggg[acg]aaa|ttt[cgt]ccct 3 agggt[cgt]aa|tt[acg]accct 4 agggta[cgt]a|t[acg]taccct 3 agggtaa[cgt]|[acg]ttaccct 5 101745 100000 133640