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.140.14?407  0% 0% 0% 100%
1.0PyPy 2 0.140.14?407  0% 100% 7% 7%
1.1PyPy 3 #3 0.160.16?407  0% 11% 100% 0%
1.1PyPy 3 0.160.16?407  0% 0% 0% 100%
1.1PyPy 3 0.160.16?407  6% 6% 100% 0%
1.1PyPy 3 #3 0.160.16?407  6% 100% 6% 0%
1.1PyPy 3 #3 0.160.16?407  6% 0% 0% 100%
1.1PyPy 2 0.140.16?407  6% 6% 88% 6%
1.2PyPy 3 0.160.17?407  0% 5% 0% 88%
2.0Cython 0.280.281,844419  100% 3% 7% 4%
2.0Cython 0.280.291,892419  7% 100% 7% 7%
2.0Cython 0.290.291,828419  100% 10% 7% 0%
3.8Python 2 0.550.557,060407  100% 4% 0% 0%
3.9Python 2 0.550.557,052407  0% 0% 100% 2%
3.9Python 2 0.550.567,068407  98% 5% 0% 2%
5.5Pyston 0.790.7928,624407  0% 100% 0% 1%
5.5Pyston 0.790.7928,572407  0% 99% 0% 0%
5.7Pyston 0.800.8128,536407  6% 94% 1% 0%
9.6Graal #3 1.931.36405,884407  39% 63% 43% 3%
9.6Graal #3 1.941.37405,888407  42% 53% 43% 12%
9.7Graal #3 1.971.38405,904407  88% 19% 11% 32%
9.8Graal 2.001.39405,212407  36% 24% 64% 32%
10Graal 2.081.41405,524407  13% 44% 82% 24%
10Graal 2.051.42405,436407  70% 29% 8% 43%
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%
14IronPython 1.872.0363,780407  60% 27% 2% 3%
14IronPython 1.952.0459,312407  3% 79% 13% 1%
14IronPython 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%
122MicroPython #2 23.3317.396,348448  26% 28% 39% 23%
123MicroPython #2 23.3617.476,344448  24% 23% 38% 30%
125MicroPython #2 23.7217.776,256448  34% 18% 32% 29%
134Nuitka #2 26.0918.9814,136448  33% 21% 41% 28%
134Nuitka #2 26.0219.0014,024448  30% 32% 31% 33%
136PyPy 3 #2 26.3219.3271,604448  25% 37% 30% 35%
137PyPy 3 #2 26.4419.4171,724448  30% 31% 36% 31%
137PyPy 3 #2 26.4719.4771,600448  35% 29% 30% 33%
137Nuitka #2 26.5219.5114,136448  32% 32% 36% 29%
140Python development version #2 26.1619.9213,012448  24% 31% 30% 34%
142Python development version #2 26.2920.2013,240448  27% 23% 27% 41%
143Python development version #2 26.5620.3213,164448  25% 28% 35% 38%
151Python 3 #2 27.1621.4613,224448  31% 33% 26% 33%
152Python 3 #2 27.2421.6413,344448  31% 36% 27% 34%
153Python 3 #2 27.2721.7513,308448  34% 35% 27% 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