/mobile Handheld Friendly website
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 |
|---|---|---|---|---|---|
| 250,000 | 4.78 | 4.81 | 49,924 | 647 | 1% 0% 0% 100% |
| 2,500,000 | 46.35 | 46.43 | 19,444 | 647 | 1% 0% 0% 100% |
| 25,000,000 | 474.71 | 474.95 | 426,212 | 647 | 1% 0% 0% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read k-nucleotide benchmark to see what this program should do.
Python 3.3.1 (default, Apr 11 2013, 12:56:47) [GCC 4.7.2] on linux
# The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org/ # # submitted by Ian Osgood # modified by Sokolov Yura # modified by bearophile # modified by xfm for parallelization # modified by Justin Peel from sys import stdin from collections import defaultdict from multiprocessing import Pool def gen_freq(frame) : global sequence frequences = defaultdict(int) if frame != 1: for ii in range(len(sequence)-frame+1) : frequences[sequence[ii:ii+frame]] += 1 else: for nucleo in sequence: frequences[nucleo] += 1 return frequences def sort_seq(length): frequences = gen_freq(length) n= sum(frequences.values()) l = sorted(list(frequences.items()), reverse=True, key=lambda seq_freq: (seq_freq[1],seq_freq[0])) return '\n'.join("%s %.3f" % (st, 100.0*fr/n) for st,fr in l) def find_seq(s): t = gen_freq(len(s)) return (s,t.get(s,0)) def prepare(f=stdin) : for line in f: if line[0] in ">;": if line[1:3] == "TH": break seq = [] app = seq.append for line in f: if line[0] in ">;": break app( line ) return "".join(seq).upper().replace('\n','') def init(arg): global sequence sequence = arg def main(): global sequence sequence = prepare() p=Pool() res2 = p.map_async(find_seq,reversed("GGT GGTA GGTATT GGTATTTTAATT GGTATTTTAATTTATAGT".split())) res1 = p.map_async(sort_seq,(1,2)) for s in res1.get() : print (s+'\n') res2 = reversed([r for r in res2.get()]) print ("\n".join("{1:d}\t{0}".format(*s) for s in res2)) if __name__=='__main__' : main()
Thu, 11 Apr 2013 20:50:20 GMT MAKE: mv knucleotide.python3-8.python3 knucleotide.python3-8.py 0.02s to complete and log all make actions COMMAND LINE: /usr/local/src/Python-3.3.1/bin/python3.3 knucleotide.python3-8.py 0 < knucleotide-input25000000.txt PROGRAM OUTPUT: A 30.295 T 30.151 C 19.800 G 19.754 AA 9.177 TA 9.132 AT 9.131 TT 9.091 CA 6.002 AC 6.001 AG 5.987 GA 5.984 CT 5.971 TC 5.971 GT 5.957 TG 5.956 CC 3.917 GC 3.911 CG 3.909 GG 3.902 1471758 GGT 446535 GGTA 47336 GGTATT 893 GGTATTTTAATT 893 GGTATTTTAATTTATAGT