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|
|5,000,000||43.44||54.49||17,884||448||16% 14% 14% 17% 8% 10% 8% 6%|
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/ # Contributed by Antti Kervinen # Modified by Tupteq # 2to3 import sys import _thread # Set minimum stack size for threads, otherwise the program may fail # to create such a many threads _thread.stack_size(32*1024) def threadfun(number, lock_acquire, next_release): global n while 1: lock_acquire() if n > 0: n -= 1 next_release() else: print(number) main_lock.release() # main n = int(sys.argv) main_lock = _thread.allocate_lock() main_lock.acquire() first_lock = _thread.allocate_lock() next_lock = first_lock for number in range(503): lock = next_lock lock.acquire() next_lock = _thread.allocate_lock() if number < 502 else first_lock _thread.start_new_thread(threadfun, (number+1, lock.acquire, next_lock.release)) first_lock.release() main_lock.acquire()
Wed, 28 Sep 2022 09:45:06 GMT COMMAND LINE: /usr/bin/rustpython threadring.rustpython-2.rustpython 5000000 PROGRAM OUTPUT: 181 encodings initialization failed. Only utf-8 encoding will be supported. ModuleNotFoundError: No module named 'encodings' The above exception was the direct cause of the following exception: RuntimeError: Could not import encodings. Is your RUSTPYTHONPATH set? If you don't have access to a consistent external environment (e.g. if you're embedding rustpython in another application), try enabling the freeze-stdlib feature