Each table row shows performance measurements for this program with a particular command-line input value N.
N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
---|
Read the ↓ make, command line, and program output logs to see how this program was run.
Read benchmark to see what this program should do.
# The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org/ # # submitted by Ian Osgood # modified by Sokolov Yura # modified by bearophile # modified by jacek2v: few changes in algorytm, added multiprocessing, used str.count (nucleo newer overlapping) from sys import stdin from collections import defaultdict from multiprocessing import Process, Pool, cpu_count def gen_freq(seq, frame): frequences = defaultdict(int) ns = len(seq) + 1 - frame for ii in range(ns): frequences[seq[ii:ii + frame]] += 1 return ns, frequences def sort_seq(seq, length): n, frequences = gen_freq(seq, length) #l = sorted(frequences.items(), reverse=True, key=lambda (seq,freq): (freq,seq)) l = sorted(list(frequences.items()), reverse=True, key=lambda seq_freq: (seq_freq[1],seq_freq[0])) return [(st, 100.0*fr/n) for st, fr in l] def find_seq(seq, nucleo): count = seq.count(nucleo) return nucleo, count def load(): for line in stdin: if line[0:3] == ">TH": break seq = [] for line in stdin: if line[0] in ">;": break seq.append( line[:-1] ) return seq def main(): nucleos = "GGT GGTA GGTATT GGTATTTTAATT GGTATTTTAATTTATAGT" sequence = "".join(load()).upper() plres = [] pl = Pool(processes=cpu_count() + 1) for nl in 1,2: plres.append(pl.apply_async(sort_seq, (sequence, nl, ))) for se in nucleos.split(): plres.append(pl.apply_async(find_seq, (sequence, se, ))) pl.close() pl.join() for ii in 0,1: print('\n'.join("%s %.3f" % (st, fr) for st,fr in plres[ii].get())) print('') for ii in range(2, len(nucleos.split()) + 2): print("%d\t%s" % (plres[ii].get()[1], plres[ii].get()[0])) main()
Sun, 23 Apr 2023 09:14:44 GMT MAKE: make[1]: Vstupuje se do adresáře „/home/dundee/work/pybenchmarks/bencher/tmp/knucleotide/tmp“ cp knucleotide.cython-2.cython `echo knucleotide.cython-2.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx cythonize -3 -bi `echo knucleotide.cython-2.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx Compiling /home/dundee/work/pybenchmarks/bencher/tmp/knucleotide/tmp/knucleotide.pyx because it changed. [1/1] Cythonizing /home/dundee/work/pybenchmarks/bencher/tmp/knucleotide/tmp/knucleotide.pyx make[1]: Opouští se adresář „/home/dundee/work/pybenchmarks/bencher/tmp/knucleotide/tmp“ 3.92s to complete and log all make actions COMMAND LINE: /usr/bin/python3 -c "import knucleotide" 0 < knucleotide-input10000.txt TIMED OUT after 300s PROGRAM OUTPUT: