performance measurements

Each table row shows performance measurements for this Cython program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
10,0000.090.09?618  0% 100% 0% 0%
10,0000.090.10?618  0% 91% 0% 0%
10,0000.100.11?618  27% 80% 27% 18%

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.

 notes

 k-nucleotide Cython program source code

# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# submitted by Ian Osgood
# modified by Sokolov Yura
# modified by bearophile
# 2to3

from sys import stdin


def gen_freq(seq, int frame, frequences):
    cdef int ns, ii

    ns = len(seq) + 1 - frame
    frequences.clear()
    for ii in range(ns):
        nucleo = seq[ii:ii + frame]
        if nucleo in frequences:
            frequences[nucleo] += 1
        else:
            frequences[nucleo] = 1
    return ns, frequences


def sort_seq(seq, int length, frequences):
    cdef int n
    cdef float fr

    n, frequences = gen_freq(seq, length, frequences)

    l = sorted(list(frequences.items()), reverse=True, key=lambda seq_freq: (seq_freq[1], seq_freq[0]))

    print('\n'.join("%s %.3f" % (st, 100.0*fr/n) for st, fr in l))
    print()


def find_seq(seq, s, frequences):
    n, t = gen_freq(seq, len(s), frequences)
    print("%d\t%s" % (t.get(s, 0), s))


def main():
    cdef int nl

    frequences = {}
    for line in stdin:
        if line[0:3] == ">TH":
            break

    seq = []
    for line in stdin:
        if line[0] in ">;":
            break
        seq.append(line[:-1])
    sequence = "".join(seq).upper()

    for nl in 1, 2:
        sort_seq(sequence, nl, frequences)

    for se in "GGT GGTA GGTATT GGTATTTTAATT GGTATTTTAATTTATAGT".split():
        find_seq(sequence, se, frequences)

main()

 make, command-line, and program output logs

Mon, 15 Oct 2018 12:13:15 GMT

MAKE:
make[1]: Vstupuje se do adresáře „/home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp“
cp knucleotide.cython `echo knucleotide.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx
cythonize -3 -bi `echo knucleotide.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx
Compiling /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/knucleotide.pyx because it changed.
[1/1] Cythonizing /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/knucleotide.pyx
running build_ext
building 'knucleotide' extension
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee/workspace
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee/workspace/benchmarksgame
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee/workspace/benchmarksgame/bencher
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee/workspace/benchmarksgame/bencher/tmp
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector-strong -fno-plt -flto=4 -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector-strong -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fstack-protector-strong -fno-plt -fPIC -I/usr/include/python3.7m -c /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/knucleotide.c -o /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/knucleotide.o
gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=4 -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/tmp01o4pc_o/home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/knucleotide.o -L/usr/lib -lpython3.7m -o /home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp/knucleotide.cpython-37m-x86_64-linux-gnu.so
make[1]: Opouští se adresář „/home/dundee/workspace/benchmarksgame/bencher/tmp/knucleotide/tmp“
4.04s to complete and log all make actions

COMMAND LINE:
/usr/bin/python3 -c "import knucleotide" 0 < knucleotide-input10000.txt

PROGRAM OUTPUT:
A 30.284
T 29.796
C 20.312
G 19.608

AA 9.212
AT 8.950
TT 8.948
TA 8.936
CA 6.166
CT 6.100
AC 6.086
TC 6.042
AG 6.036
GA 5.968
TG 5.868
GT 5.798
CC 4.140
GC 4.044
CG 3.906
GG 3.798

562	GGT
152	GGTA
15	GGTATT
0	GGTATTTTAATT
0	GGTATTTTAATTTATAGT

Revised BSD license

  Home   Conclusions   License   Play