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 #3 0.140.14?407  0% 100% 0% 0%
1.0PyPy 3 #3 0.140.14?407  0% 0% 0% 100%
1.0PyPy 3 0.140.14?407  0% 0% 100% 0%
1.0PyPy 3 #3 0.140.14?407  0% 50% 50% 0%
1.0PyPy 3 0.140.14?407  7% 7% 0% 100%
1.0PyPy 3 0.140.14?407  0% 0% 100% 0%
1.1PyPy 2 0.150.15?407  0% 0% 100% 0%
1.1PyPy 2 0.150.15?407  0% 0% 100% 0%
1.2PyPy 2 0.160.16?407  59% 41% 0% 0%
2.0Cython 0.280.281,864419  3% 72% 11% 29%
2.0Cython 0.280.281,892419  4% 0% 4% 100%
2.1Cython 0.280.291,836419  0% 3% 3% 100%
3.9Python 2 0.540.546,912407  0% 0% 100% 0%
4.0Python 2 0.540.546,948407  98% 2% 2% 0%
4.0Python 2 0.550.557,072407  2% 100% 0% 2%
4.2Python 3 #3 0.570.579,040407  2% 0% 2% 100%
4.2Python 3 0.570.579,312407  2% 0% 98% 2%
4.2Python 3 0.570.579,268407  0% 100% 0% 2%
4.2Python 3 #3 0.570.579,100407  0% 100% 0% 2%
4.2Python 3 #3 0.570.579,100407  100% 0% 2% 0%
4.2Python 3 0.570.579,312407  0% 100% 0% 0%
4.4Python development version 0.600.607,840407  2% 98% 0% 0%
4.4Python development version #3 0.600.608,100407  2% 0% 100% 0%
4.4Python development version 0.600.608,072407  0% 100% 0% 0%
4.4Python development version #3 0.600.608,104407  2% 98% 2% 0%
4.4Python development version #3 0.600.608,128407  0% 98% 0% 2%
4.4Python development version 0.610.617,824407  100% 0% 2% 0%
4.6Nuitka 0.630.6318,060407  2% 0% 100% 0%
4.6Nuitka #3 0.630.6317,992407  0% 100% 2% 2%
4.6Nuitka #3 0.630.6318,008407  2% 0% 100% 3%
4.7Nuitka #3 0.640.6418,056407  0% 98% 2% 0%
4.7Nuitka 0.640.6418,076407  2% 3% 0% 98%
4.7Nuitka 0.640.6518,124407  0% 100% 2% 0%
5.3MicroPython #3 0.730.732,500407  100% 0% 0% 0%
5.4MicroPython 0.730.732,352407  3% 0% 100% 0%
5.4MicroPython #3 0.730.732,396407  1% 1% 0% 100%
5.4MicroPython 0.730.742,312407  0% 99% 0% 3%
5.4MicroPython #3 0.730.742,392407  100% 1% 1% 1%
5.4MicroPython 0.730.742,328407  0% 0% 100% 1%
5.7Pyston 0.790.7928,624407  0% 100% 0% 1%
5.8Pyston 0.790.7928,572407  0% 99% 0% 0%
5.9Pyston 0.800.8128,536407  6% 94% 1% 0%
13Jython 4.411.83222,952407  63% 72% 60% 48%
14Jython 4.521.87270,388407  65% 66% 45% 66%
14Jython 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%
99MicroPython #2 16.6713.556,344448  23% 24% 24% 24%
100MicroPython #2 16.9013.746,296448  20% 23% 25% 27%
101MicroPython #2 16.9113.786,328448  26% 20% 28% 23%
103PyPy 3 #2 18.2814.0969,904448  24% 24% 27% 34%
103PyPy 3 #2 18.3414.1669,412448  28% 22% 29% 31%
103PyPy 3 #2 18.3014.1769,108448  29% 31% 15% 35%
107Nuitka #2 18.5414.6216,024448  24% 36% 18% 30%
107Nuitka #2 18.4314.6415,924448  27% 23% 26% 32%
107Nuitka #2 18.5014.6915,932448  23% 29% 26% 29%
108Python development version #2 19.0314.7412,228448  30% 29% 14% 34%
108Python development version #2 19.1414.8011,952448  29% 24% 17% 36%
109Python development version #2 19.2214.8711,940448  23% 31% 19% 32%
111Python 3 #2 19.4815.2714,424448  30% 13% 42% 26%
112Python 3 #2 19.4715.3314,592448  18% 32% 24% 34%
114Python 3 #2 19.7315.5514,540448  29% 33% 27% 19%
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