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  13% 0% 0% 100%
1.0PyPy 3 #3 0.140.14?407  7% 0% 93% 0%
1.0PyPy 3 0.140.14?407  7% 0% 100% 7%
1.0PyPy 2 0.140.14?407  7% 0% 7% 100%
1.0PyPy 3 #3 0.140.14?407  100% 0% 0% 7%
1.0PyPy 3 0.140.14?407  100% 0% 0% 0%
1.1PyPy 2 0.140.15?407  7% 0% 100% 0%
1.1PyPy 3 0.130.15?407  7% 0% 88% 0%
1.1PyPy 2 0.140.16?407  0% 6% 0% 93%
2.1Cython 0.280.284,672419  4% 13% 100% 3%
2.1Cython 0.290.29844419  0% 7% 3% 100%
2.1Cython 0.290.291,864419  4% 14% 97% 14%
4.0Python 2 0.550.557,060407  100% 4% 0% 0%
4.0Python 2 0.550.557,052407  0% 0% 100% 2%
4.0Python 2 0.550.567,068407  98% 5% 0% 2%
5.3MicroPython #3 0.730.732,380407  1% 0% 3% 100%
5.4MicroPython #3 0.740.742,400407  30% 71% 3% 3%
5.5MicroPython 0.750.762,448407  100% 5% 7% 5%
5.7Pyston 0.790.7928,624407  0% 100% 0% 1%
5.7MicroPython #3 0.780.792,200407  22% 100% 10% 18%
5.7Pyston 0.790.7928,572407  0% 99% 0% 0%
5.8MicroPython 0.800.802,376407  15% 14% 100% 23%
5.8Pyston 0.800.8128,536407  6% 94% 1% 0%
6.0MicroPython 0.820.832,336407  33% 100% 23% 22%
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%
144Python development version #2 26.1619.9213,012448  24% 31% 30% 34%
146PyPy 3 #2 25.7520.1969,384448  27% 32% 27% 31%
146Python development version #2 26.2920.2013,240448  27% 23% 27% 41%
147PyPy 3 #2 25.7720.2569,672448  29% 31% 25% 32%
147Python development version #2 26.5620.3213,164448  25% 28% 35% 38%
147PyPy 3 #2 25.8620.3269,312448  29% 32% 27% 31%
149MicroPython #2 25.3820.516,360448  31% 28% 29% 28%
152Nuitka #2 26.7520.9114,300448  35% 29% 34% 27%
152Nuitka #2 26.7220.9114,220448  37% 32% 35% 23%
153Nuitka #2 26.7721.0714,048448  33% 37% 32% 24%
155MicroPython #2 26.1221.346,360448  33% 34% 33% 34%
156Python 3 #2 27.1621.4613,224448  31% 33% 26% 33%
157Python 3 #2 27.2421.6413,344448  31% 36% 27% 34%
158Python 3 #2 27.2721.7513,308448  34% 35% 27% 32%
173MicroPython #2 27.5423.836,416448  54% 54% 52% 53%
missing benchmark programs
Shedskin No program
Numba No program
Graal 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