performance measurements

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
500,0000.140.15?270  0% 0% 7% 93%
5,000,0001.191.194,404270  2% 1% 1% 100%
50,000,00011.5311.534,412270  0% 1% 1% 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

Python 3.4.0 (default, Mar 17 2014, 08:23:52) [GCC 4.8.1] on linux

 thread-ring Python 3 #3 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(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)
                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, 17 Mar 2014 23:44:38 GMT

MAKE:
mv threadring.python3-3.python3 threadring.python3-3.py
0.01s to complete and log all make actions

COMMAND LINE:
/usr/local/src/Python-3.4.0/bin/python3.4 threadring.python3-3.py 50000000

PROGRAM OUTPUT:
292

Revised BSD license

  Home   Conclusions   License   Play