thread-ring benchmark N=5,000,000

Each chart bar shows how many times slower, one ↓ thread-ring program was, compared to the fastest program.

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.

    sort sortsort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0PyPy 3 0.140.14?407  0% 7% 100% 0%
1.0PyPy 3 #3 0.140.14?407  100% 0% 0% 0%
1.0PyPy 3 #3 0.140.14?407  0% 0% 100% 7%
1.1PyPy 2 0.150.15?407  0% 0% 100% 0%
1.1PyPy 3 0.150.15?407  7% 7% 100% 13%
1.1PyPy 2 0.150.15?407  0% 0% 100% 0%
1.1PyPy 3 #3 0.140.16?407  0% 6% 82% 0%
1.2PyPy 2 0.160.16?407  59% 41% 0% 0%
1.2PyPy 3 0.160.17?407  6% 22% 53% 50%
2.1Cython 0.290.291,800419  7% 0% 3% 100%
2.1Cython 0.290.291,860419  0% 0% 100% 0%
2.1Cython 0.290.291,892419  3% 100% 0% 0%
3.9Python 2 0.540.546,912407  0% 0% 100% 0%
3.9Python 2 0.540.546,948407  98% 2% 2% 0%
3.9Python 2 0.550.557,072407  2% 100% 0% 2%
4.1Python 3 #3 0.570.579,364407  0% 100% 2% 0%
4.1Python 3 0.570.579,564407  100% 2% 0% 2%
4.1Python 3 #3 0.570.579,300407  2% 0% 2% 100%
4.1Python 3 0.570.579,344407  0% 0% 2% 100%
4.1Python 3 #3 0.570.579,104407  100% 0% 0% 0%
4.1Python 3 0.580.589,588407  2% 100% 5% 0%
4.3Python development version 0.600.607,840407  2% 98% 0% 0%
4.3Python development version #3 0.600.608,100407  2% 0% 100% 0%
4.3Python development version #3 0.600.608,104407  2% 98% 2% 0%
4.3Python development version 0.600.608,072407  0% 100% 0% 0%
4.3Python development version #3 0.600.608,128407  0% 98% 0% 2%
4.3Python development version 0.610.617,824407  100% 0% 2% 0%
4.6Nuitka 0.650.6517,784407  5% 22% 3% 78%
4.7Nuitka #3 0.650.6517,948407  100% 2% 2% 0%
4.7Nuitka 0.650.6617,744407  2% 0% 100% 3%
4.7Nuitka 0.660.6617,784407  2% 2% 100% 5%
4.8Nuitka #3 0.660.6718,016407  100% 2% 2% 2%
4.8Nuitka #3 0.670.6818,016407  4% 4% 1% 100%
5.2MicroPython #3 0.730.732,380407  1% 0% 3% 100%
5.3MicroPython #3 0.740.742,400407  30% 71% 3% 3%
5.4MicroPython 0.750.762,448407  100% 5% 7% 5%
5.6Pyston 0.790.7928,624407  0% 100% 0% 1%
5.6MicroPython #3 0.780.792,200407  22% 100% 10% 18%
5.6Pyston 0.790.7928,572407  0% 99% 0% 0%
5.7MicroPython 0.800.802,376407  15% 14% 100% 23%
5.8Pyston 0.800.8128,536407  6% 94% 1% 0%
5.9MicroPython 0.820.832,336407  33% 100% 23% 22%
13Jython 4.411.83222,952407  63% 72% 60% 48%
13Jython 4.521.87270,388407  65% 66% 45% 66%
13Jython 4.641.88266,428407  55% 61% 74% 57%
15IronPython 1.872.0363,780407  60% 27% 2% 3%
15IronPython 1.952.0459,312407  3% 79% 13% 1%
15IronPython 1.892.0558,920407  2% 21% 62% 8%
15Grumpy 2.232.108,456407  34% 22% 31% 28%
15Grumpy 2.232.107,752407  26% 32% 27% 36%
15Grumpy 2.262.128,248407  30% 30% 26% 31%
105Python development version #2 19.0314.7412,228448  30% 29% 14% 34%
106Python development version #2 19.1414.8011,952448  29% 24% 17% 36%
106Python development version #2 19.2214.8711,940448  23% 31% 19% 32%
146MicroPython #2 25.3820.516,360448  31% 28% 29% 28%
147PyPy 3 #2 26.5120.5269,096448  32% 29% 27% 32%
147PyPy 3 #2 26.5320.5269,068448  31% 29% 31% 29%
147PyPy 3 #2 26.5520.5969,664448  31% 32% 34% 27%
149Nuitka #2 27.0520.8415,888448  28% 32% 27% 32%
150Nuitka #2 27.0520.9715,940448  38% 24% 34% 25%
150Nuitka #2 27.1521.0015,692448  30% 30% 29% 31%
152MicroPython #2 26.1221.346,360448  33% 34% 33% 34%
154Python 3 #2 27.7321.5814,604448  22% 27% 36% 31%
156Python 3 #2 27.8821.8214,476448  27% 26% 30% 33%
156Python 3 #2 27.9221.8714,456448  25% 29% 32% 31%
170MicroPython #2 27.5423.836,416448  54% 54% 52% 53%
missing benchmark programs
Shedskin No program
Numba 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