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.110.11?407  0% 0% 92% 0%
1.0PyPy 2 0.110.12?407  0% 100% 0% 0%
1.0PyPy 2 0.110.12?407  8% 0% 100% 0%
1.1PyPy 3 #3 0.120.13?407  7% 100% 0% 0%
1.1PyPy 3 0.120.13?407  100% 0% 0% 0%
1.1PyPy 3 #3 0.130.13?407  0% 93% 0% 0%
1.1PyPy 3 #3 0.130.13?407  7% 0% 7% 100%
1.2PyPy 3 0.140.14?407  100% 14% 14% 8%
1.4PyPy 3 0.150.15?407  27% 25% 25% 100%
3.3Cython 0.370.371,616407  3% 3% 100% 0%
3.3Cython 0.370.381,664407  0% 3% 3% 100%
3.3Cython 0.370.381,624407  0% 8% 100% 5%
6.7MicroPython 0.760.772,356407  100% 0% 0% 1%
6.8MicroPython #3 0.770.772,136407  1% 1% 100% 0%
6.8MicroPython 0.770.772,344407  1% 1% 0% 100%
6.8Python 2 0.770.776,432407  4% 0% 4% 100%
6.8MicroPython #3 0.770.782,316407  0% 99% 0% 1%
6.8Python 2 0.770.786,424407  4% 5% 100% 4%
6.8MicroPython #3 0.780.782,252407  0% 100% 0% 0%
6.9MicroPython 0.780.782,268407  1% 100% 10% 1%
6.9Python 2 0.780.796,444407  7% 99% 8% 3%
7.0Python 3 0.800.809,104407  100% 1% 0% 2%
7.0Python 3 #3 0.800.809,216407  96% 4% 0% 1%
7.0Python 3 0.800.809,212407  0% 0% 1% 100%
7.1Python 3 #3 0.800.809,124407  100% 0% 0% 0%
7.1Python 3 #3 0.800.819,104407  0% 100% 0% 2%
7.1Python 3 0.810.819,096407  0% 100% 10% 2%
8.3Python development version #3 0.950.957,928407  22% 4% 79% 2%
8.4Python development version #3 0.950.957,984407  5% 100% 1% 2%
8.4Python development version 0.950.958,072407  100% 1% 1% 1%
8.4Python development version 0.950.968,020407  23% 3% 77% 4%
8.4Python development version #3 0.960.967,888407  3% 3% 100% 3%
8.5Python development version 0.970.977,984407  10% 3% 4% 100%
9.2Pyston 1.051.0529,760407  3% 0% 99% 1%
9.2Pyston 1.051.0538,048407  100% 0% 4% 1%
9.3Pyston 1.051.0629,900407  2% 11% 100% 3%
10Nuitka 1.171.1719,560407  3% 4% 3% 100%
10Nuitka #3 1.191.1919,600407  7% 99% 3% 8%
11Nuitka 1.251.2519,556407  14% 99% 21% 9%
11Nuitka 1.281.2819,644407  13% 35% 100% 4%
13Nuitka #3 1.481.4919,644407  26% 29% 100% 69%
13Nuitka #3 1.521.5219,584407  99% 25% 27% 69%
22IronPython 2.432.4675,704407  5% 42% 5% 55%
22IronPython 2.412.4675,436407  45% 4% 52% 3%
22IronPython 2.462.4875,420407  5% 33% 6% 64%
25Grumpy 3.032.858,280407  28% 29% 26% 27%
25Grumpy 3.072.898,516407  27% 27% 25% 32%
25Grumpy 3.072.898,572407  29% 27% 34% 23%
29Jython 8.243.25292,532407  69% 56% 71% 80%
30Jython 8.573.38292,044407  71% 68% 84% 51%
31Jython 9.143.54293,336407  74% 68% 64% 78%
151PyPy 3 #2 22.8117.2138,244448  31% 36% 30% 33%
153PyPy 3 #2 23.0317.5038,368448  35% 34% 30% 26%
154PyPy 3 #2 23.1017.5338,336448  23% 47% 16% 39%
155MicroPython #2 22.2317.666,312448  27% 32% 23% 26%
157MicroPython #2 22.4917.876,252448  30% 30% 31% 16%
157MicroPython #2 22.5817.926,284448  33% 26% 33% 14%
179Python 3 #2 26.3020.4614,060448  33% 28% 17% 35%
185Python 3 #2 27.0521.0414,244448  31% 29% 20% 33%
186Nuitka #2 27.0621.2215,536448  42% 37% 37% 36%
187Python 3 #2 27.3521.3014,020448  55% 7% 49% 5%
194Nuitka #2 27.8922.0815,788448  43% 43% 37% 41%
199Nuitka #2 28.0622.6915,528448  50% 51% 50% 38%
204Python development version #2 29.8423.2713,156448  33% 31% 27% 30%
211Python development version #2 31.3724.0912,996448  17% 51% 9% 48%
216Python development version #2 31.3024.5913,004448  36% 42% 34% 34%
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