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 2 0.090.09?407  10% 100% 0% 0%
1.0PyPy 2 0.090.09?407  0% 0% 100% 0%
1.1PyPy 2 0.090.09?407  0% 0% 27% 70%
1.1PyPy 3 0.100.10?407  70% 0% 0% 22%
1.1PyPy 3 0.100.10?407  0% 100% 0% 0%
1.1PyPy 3 #3 0.100.10?407  100% 0% 0% 0%
1.1PyPy 3 #3 0.100.10?407  100% 0% 0% 0%
1.1PyPy 3 0.100.10?407  0% 0% 0% 100%
1.5PyPy 3 #3 0.130.13?407  0% 0% 43% 62%
3.2Cython 0.280.281,864419  3% 72% 11% 29%
3.2Cython 0.280.281,892419  4% 0% 4% 100%
3.3Cython 0.280.291,836419  0% 3% 3% 100%
6.2Python 2 0.540.546,912407  0% 0% 100% 0%
6.2Python 2 0.540.546,948407  98% 2% 2% 0%
6.3Python 2 0.550.557,072407  2% 100% 0% 2%
6.5Python 3 #3 0.570.579,168407  0% 63% 2% 38%
6.5Python 3 #3 0.570.579,288407  2% 0% 4% 96%
6.6Python 3 0.570.579,136407  0% 100% 0% 2%
6.6Python 3 0.570.579,328407  0% 2% 96% 0%
6.6Python 3 #3 0.570.579,120407  0% 2% 0% 100%
6.6Python 3 0.570.579,236407  0% 2% 0% 98%
6.9Python development version 0.600.607,840407  2% 98% 0% 0%
6.9Nuitka 0.600.6018,128407  100% 0% 0% 2%
6.9Python development version #3 0.600.608,100407  2% 0% 100% 0%
6.9Python development version #3 0.600.608,104407  2% 98% 2% 0%
6.9Python development version 0.600.608,072407  0% 100% 0% 0%
6.9Python development version #3 0.600.608,128407  0% 98% 0% 2%
7.0Python development version 0.610.617,824407  100% 0% 2% 0%
7.1Nuitka #3 0.620.6217,788407  0% 100% 0% 0%
7.1Nuitka #3 0.620.6217,768407  2% 0% 0% 100%
7.1Nuitka #3 0.620.6218,132407  0% 0% 0% 100%
7.2Nuitka 0.630.6318,128407  2% 0% 100% 0%
7.5Nuitka 0.650.6517,692407  98% 0% 2% 0%
8.4MicroPython #3 0.730.732,500407  100% 0% 0% 0%
8.4MicroPython 0.730.732,352407  3% 0% 100% 0%
8.4MicroPython #3 0.730.732,396407  1% 1% 0% 100%
8.4MicroPython 0.730.742,312407  0% 99% 0% 3%
8.4MicroPython 0.730.742,328407  0% 0% 100% 1%
8.4MicroPython #3 0.730.742,392407  100% 1% 1% 1%
9.0Pyston 0.790.7928,624407  0% 100% 0% 1%
9.1Pyston 0.790.7928,572407  0% 99% 0% 0%
9.3Pyston 0.800.8128,536407  6% 94% 1% 0%
21Jython 4.411.83222,952407  63% 72% 60% 48%
22Jython 4.521.87270,388407  65% 66% 45% 66%
22Jython 4.641.88266,428407  55% 61% 74% 57%
23IronPython 1.872.0363,780407  60% 27% 2% 3%
23IronPython 1.952.0459,312407  3% 79% 13% 1%
24IronPython 1.892.0558,920407  2% 21% 62% 8%
24Grumpy 2.232.108,456407  34% 22% 31% 28%
24Grumpy 2.232.107,752407  26% 32% 27% 36%
24Grumpy 2.262.128,248407  30% 30% 26% 31%
152PyPy 3 #2 17.1813.2461,064448  34% 18% 27% 25%
152PyPy 3 #2 17.2013.2460,760448  27% 26% 20% 32%
154PyPy 3 #2 17.4513.4060,744448  14% 28% 28% 34%
156MicroPython #2 16.6713.556,344448  23% 24% 24% 24%
158MicroPython #2 16.9013.746,296448  20% 23% 25% 27%
158MicroPython #2 16.9113.786,328448  26% 20% 28% 23%
159Nuitka #2 17.9413.8515,640448  28% 23% 25% 29%
160Nuitka #2 17.9913.9015,980448  24% 31% 29% 21%
161Nuitka #2 18.0813.9715,676448  30% 32% 16% 28%
165Python 3 #2 18.4214.3714,580448  31% 17% 37% 20%
167Python 3 #2 18.5814.5514,520448  30% 28% 29% 17%
169Python 3 #2 18.7714.7314,448448  21% 31% 21% 32%
169Python development version #2 19.0314.7412,228448  30% 29% 14% 34%
170Python development version #2 19.1414.8011,952448  29% 24% 17% 36%
171Python development version #2 19.2214.8711,940448  23% 31% 19% 32%
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