thread-ring benchmark N=50,000,000

Each chart bar shows how many times more Memory, one ↓ thread-ring program used, compared to the program that used least Memory.

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.

    sortsort sort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0OCaml #2 154.76154.84640350  0% 0% 0% 100%
3.8C gcc #2 130.95131.002,424575  1% 1% 1% 100%
4.1C gcc #3 155.85155.912,596916  100% 1% 1% 1%
4.5Go #5 11.2211.232,884405  1% 0% 0% 100%
4.7OCaml #3 151.64151.713,004296  0% 0% 0% 100%
4.7C++ g++ 175.50175.573,016636  1% 1% 1% 100%
4.8Haskell GHC 7.007.003,040306  1% 1% 1% 100%
9.8Python 3 #2 212.95213.066,260288  0% 1% 0% 100%
10C++ g++ #4 9.189.196,604572  1% 1% 0% 100%
10C++ g++ #5 8.848.856,604652  1% 1% 0% 100%
12C gcc 136.42136.477,504487  0% 0% 0% 100%
12C++ g++ #2 136.06136.127,508588  1% 1% 0% 100%
13OCaml 5 min5 min8,600282  0% 0% 0% 100%
23Ada 2005 GNAT 5 min5 min14,744602  0% 1% 1% 100%
23Ada 2005 GNAT #3 182.70182.7714,812727  0% 1% 1% 100%
23Ada 2005 GNAT #4 182.56182.6314,828960  1% 1% 1% 100%
24Ruby 259.66259.8015,576331  0% 1% 1% 100%
26Ada 2005 GNAT #2 5 min5 min16,864560  0% 1% 1% 100%
33C# Mono 255.76255.8720,936476  0% 1% 1% 100%
35Smalltalk VisualWorks #2 48.8248.8422,480566  0% 0% 0% 100%
35Java  #7 253.80253.9122,712473  1% 1% 0% 100%
37C# Mono #2 6 min6 min23,844591  0% 1% 1% 100%
51F# Mono #3 19.8119.8332,832329  0% 1% 1% 100%
65F# Mono #2 153.79154.3841,464555  0% 1% 1% 100%
80Racket 163.53163.6151,060262  0% 1% 1% 100%
420Erlang HiPE 11.0719.08268,880273  0% 0% 0% 59%
434Java  #3 256.69256.82277,448530  1% 1% 0% 100%
600Clojure #2 83.5883.67383,832299  0% 1% 1% 100%
602Clojure 86.8986.98385,508348  1% 1% 1% 100%
1,382Lisp SBCL #2 261.66261.77884,476571  1% 1% 1% 100%
C CINT Failed487
C CINT #2 Failed575
C gcc #4 Timed Out5 min761
Lisp SBCL Timed Out10 min618
Pascal Free Pascal Make Error523
Perl #3 Failed489
Perl Failed353
Ruby #2 Bad Output215
Ruby JRuby #2 Failed228
Ruby JRuby Failed342
Scala Failed296
"wrong" (different) algorithm / less comparable programs
1.7Lua #3 19.2419.251,080264
6.9Python 3 #3 11.5311.534,412270
7.1C++ g++ #3 9.169.174,556726
23Ada 2005 GNAT #5 0.540.5514,8281476
36F# Mono #4 2.192.2022,756267
408Java  #5 19.3119.32261,092432
417Java  #2 5.355.36267,052693
440Java  #6 1.251.26281,844543
515Java  #4 36.5436.56329,752894
missing benchmark programs
Dart No program
Fortran Intel No program
JavaScript V8 No program
Lua No program
PHP No program
Rust 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