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
5,000,0000.290.291,864419  4% 14% 97% 14%
5,000,0000.280.284,672419  4% 13% 100% 3%
5,000,0000.290.29844419  0% 7% 3% 100%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read thread-ring benchmark to see what this program should do.

 notes

 thread-ring Cython program source code

# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# contributed by Daniel Nanz 2008-03-11

# Coroutines via enhanced generators
# 2to3

import sys
import itertools

def main(int n = int(sys.argv[1]), int n_threads=503, cycle=itertools.cycle):

    def worker(int worker_id):
        cdef int n
        n = 1
        while True:
            if n > 0:
                n = (yield (n - 1))
            else:
                print(worker_id)
                raise StopIteration

    threadRing = [worker(w) for w in range(1, n_threads + 1)]
    for t in threadRing: foo = next(t)           # start exec. gen. funcs
    sendFuncRing = [t.send for t in threadRing]   # speed...
    for send in cycle(sendFuncRing):
        try:
            n = send(n)
        except StopIteration:
            break

main()

 make, command-line, and program output logs

Mon, 15 Oct 2018 12:17:13 GMT

MAKE:
make[1]: Vstupuje se do adresáře „/home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp“
cp threadring.cython `echo threadring.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx
cythonize -3 -bi `echo threadring.cython | sed 's/cython-..//' | sed 's/.cython//'`.pyx
Compiling /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/threadring.pyx because it changed.
[1/1] Cythonizing /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/threadring.pyx
running build_ext
building 'threadring' extension
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home/dundee
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home/dundee/workspace
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home/dundee/workspace/benchmarksgame
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home/dundee/workspace/benchmarksgame/bencher
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home/dundee/workspace/benchmarksgame/bencher/tmp
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home/dundee/workspace/benchmarksgame/bencher/tmp/threadring
creating /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/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/threadring/tmp/threadring.c -o /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/tmpq3_ik_vl/home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/threadring.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/threadring/tmp/tmpq3_ik_vl/home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/threadring.o -L/usr/lib -lpython3.7m -o /home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp/threadring.cpython-37m-x86_64-linux-gnu.so
make[1]: Opouští se adresář „/home/dundee/workspace/benchmarksgame/bencher/tmp/threadring/tmp“
3.31s to complete and log all make actions

COMMAND LINE:
/usr/bin/python3 -c "import threadring" 5000000

PROGRAM OUTPUT:
181

Revised BSD license

  Home   Conclusions   License   Play