Each table row shows performance measurements for this Nuitka program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load | 
|---|---|---|---|---|---|
| 5,000,000 | 0.35 | 0.35 | 1,152 | 406 | 17% 3% 3% 0% 100% 14% 16% 9% | 
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.
# 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(n = int(sys.argv[1]), n_threads=503, cycle=itertools.cycle):
    def worker(worker_id):
        n = 1
        while True:
            if n > 0:
                n = (yield (n - 1))
            else:
                print(worker_id)
                return
    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()
Sun, 30 Jul 2023 11:18:23 GMT MAKE: make[1]: Vstupuje se do adresáře „/home/dundee/work/pybenchmarks/bencher/tmp/threadring/tmp“ nuitka3 --remove-output threadring.nuitka Nuitka-Options:INFO: Used command line options: --remove-output threadring.nuitka Nuitka-Options:WARNING: You did not specify to follow or include anything but main program. Check options and make sure that is intended. Nuitka:INFO: Starting Python compilation with Nuitka '1.6' on Python '3.11' commercial grade 'not installed'. Nuitka:INFO: Completed Python level compilation and optimization. Nuitka:INFO: Generating source code for C backend compiler. Nuitka:INFO: Running data composer tool for optimal constant value handling. Nuitka:INFO: Running C compilation via Scons. Nuitka-Scons:INFO: Backend C compiler: gcc (gcc). Nuitka-Scons:INFO: Backend linking program with 7 files (no progress information available for this stage). Nuitka-Scons:WARNING: You are not using ccache, re-compilation of identical code will be slower than necessary. Use your OS package manager to install it. Nuitka:INFO: Removing build directory 'threadring.nuitka.build'. Nuitka:INFO: Successfully created 'threadring.nuitka.bin'. cp threadring.nuitka.bin threadring.nuitka_run make[1]: Opouští se adresář „/home/dundee/work/pybenchmarks/bencher/tmp/threadring/tmp“ 15.68s to complete and log all make actions COMMAND LINE: ./threadring.nuitka_run 5000000 PROGRAM OUTPUT: 181