thread-ring benchmark N=5,000,000

Each chart bar shows how many times more Memory, one ↓ thread-ring program used, compared to the program that used least Memory.

These are not the only programs that could be written. These are not the only compilers and interpreters. These are not the only programming languages.

Column × shows how many times more each program used compared to the benchmark program that used least.

    sortsort sort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 PyPy 2 0.140.14?407  7% 0% 100% 0%
 PyPy 3 0.160.17?407  100% 6% 0% 0%
 PyPy 3 #3 0.160.16?407  100% 6% 0% 0%
 PyPy 3 #3 0.160.18?407  0% 0% 89% 0%
 PyPy 3 #3 0.160.16?407  6% 6% 6% 100%
 PyPy 2 0.150.17?407  11% 89% 11% 6%
 PyPy 3 0.160.16?407  0% 6% 100% 0%
 PyPy 3 0.160.18?407  0% 12% 22% 84%
 PyPy 2 0.150.15?407  7% 7% 94% 0%
 Cython 0.280.281,808419  4% 100% 0% 3%
 Cython 0.290.291,924419  0% 100% 3% 7%
 Cython 0.280.291,940419  97% 4% 0% 3%
 MicroPython #2 29.7922.496,328448  39% 34% 37% 32%
 MicroPython #2 32.2127.846,432448  63% 61% 65% 67%
 MicroPython #2 29.1421.516,440448  33% 32% 36% 28%
 Python 2 0.550.557,052407  0% 0% 100% 2%
 Python 2 0.550.557,060407  100% 4% 0% 0%
 Python 2 0.550.567,068407  98% 5% 0% 2%
 Grumpy 2.232.107,752407  26% 32% 27% 36%
 Grumpy 2.262.128,248407  30% 30% 26% 31%
 Grumpy 2.232.108,456407  34% 22% 31% 28%
 Python development version #2 29.7822.3212,068448  32% 30% 28% 34%
 Python development version #2 29.8922.4412,208448  33% 33% 26% 35%
 Python development version #2 30.0522.6012,216448  32% 32% 26% 33%
 Python 3 #2 32.3823.8413,176448  33% 38% 32% 29%
 Python 3 #2 32.6624.1213,232448  34% 38% 33% 31%
 Python 3 #2 32.5023.9413,280448  37% 35% 35% 30%
 Nuitka #2 29.4121.1214,144448  29% 35% 29% 30%
 Nuitka #2 28.9020.6214,144448  31% 31% 31% 30%
 Nuitka #2 28.9620.6714,196448  30% 32% 37% 27%
 Pyston 0.800.8128,536407  6% 94% 1% 0%
 Pyston 0.790.7928,572407  0% 99% 0% 0%
 Pyston 0.790.7928,624407  0% 100% 0% 1%
 IronPython 1.892.0558,920407  2% 21% 62% 8%
 IronPython 1.952.0459,312407  3% 79% 13% 1%
 IronPython 1.872.0363,780407  60% 27% 2% 3%
 PyPy 3 #2 30.6621.9972,868448  34% 36% 31% 31%
 PyPy 3 #2 30.8222.0773,256448  33% 35% 31% 33%
 PyPy 3 #2 31.5923.0073,312448  37% 39% 35% 31%
 Jython 4.411.83222,952407  63% 72% 60% 48%
 Jython 4.641.88266,428407  55% 61% 74% 57%
 Jython 4.521.87270,388407  65% 66% 45% 66%
 Graal 1.861.40413,724407  94% 12% 21% 20%
 Graal #3 1.891.39413,764407  62% 35% 17% 36%
 Graal #3 1.761.30413,784407  29% 15% 1% 100%
 Graal #3 1.881.35413,796407  8% 25% 99% 17%
 Graal 1.811.33413,916407  19% 29% 98% 6%
 Graal 1.861.36413,996407  25% 21% 9% 95%
missing benchmark programs
Shedskin No program
Numba No program
RustPython No program

 thread-ring benchmark : Switch from thread to thread passing one token

diff program output N = 1000 with this output file to check your program is correct before contributing.

Each program should create and keep alive 503 pre-emptive threads, explicity or implicitly linked in a ring, and pass a token between one thread and the next thread at least N times.

We are trying to show the performance of various programming language implementations - so we ask that contributed programs not only give the correct result, but also use the same algorithm to calculate that result.

Each program should

Similar benchmarks are described in Performance Measurements of Threads in Java and Processes in Erlang, 1998; and A Benchmark Test for BCPL Style Coroutines, 2004. (Note: 'Benchmarks that may seem to be concurrent are often sequential. The estone benchmark, for instance, is entirely sequential. So is also the most common implementation of the "ring benchmark'; usually one process is active, while the others wait in a receive statement.') For some language implementations increasing the number of threads quickly results in Death by Concurrency.

Programs may use pre-emptive kernel threads or pre-emptive lightweight threads; but programs that use non pre-emptive threads (coroutines, cooperative threads) and any programs that use custom schedulers, will be listed as interesting alternative implementations. Briefly say what concurrency technique is used in the program header comment.

Revised BSD license

  Home   Conclusions   License   Play