/mobile Handheld Friendly website

 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 5 min256.701,052350  45% 9% 8% 47%
2.9Go #5 14.8714.873,092405  0% 100% 1% 0%
3.7Haskell GHC 11.459.173,896306  100% 9% 8% 8%
4.3C gcc #3 151.54151.614,524916  100% 1% 1% 1%
4.4C gcc #4 5 min278.274,620761  23% 21% 21% 23%
4.4C gcc 5 min265.294,620487  9% 38% 39% 10%
4.4C gcc #2 5 min264.294,620575  13% 33% 33% 12%
4.4C++ g++ #2 5 min264.214,624588  14% 31% 32% 14%
5.1C++ g++ 6 min262.565,336636  37% 17% 17% 37%
5.1C++ g++ #5 8 min151.315,360652  85% 83% 83% 85%
5.1C++ g++ #4 8 min148.565,360572  85% 84% 83% 85%
5.3OCaml #3 5 min247.815,540296  51% 6% 6% 51%
9.3Python 3 #2 8 min6 min9,832288  42% 12% 12% 42%
9.4Ada 2005 GNAT #2 8 min6 min9,840560  22% 38% 38% 21%
9.4Ada 2005 GNAT #3 6 min5 min9,856727  47% 5% 5% 46%
9.4Ada 2005 GNAT 14 min8 min9,856602  38% 38% 38% 38%
9.4Ada 2005 GNAT #4 6 min5 min9,856960  16% 33% 33% 15%
13OCaml 11 min8 min13,940282  42% 18% 17% 42%
19Ruby #2 28 min19 min19,908215  31% 29% 31% 31%
19Ruby 8 min6 min19,912331  36% 37% 17% 18%
20C# Mono 14 min7 min20,524476  39% 40% 43% 62%
26Java  #7 7 min6 min27,672473  25% 25% 25% 25%
30Lisp SBCL 6 min289.7031,436618  19% 35% 35% 19%
30Lisp SBCL #2 8 min6 min31,436571  6% 53% 54% 6%
37F# Mono #3 18.6518.6438,988329  99% 1% 2% 1%
40F# Mono #2 13 min6 min42,076555  44% 58% 58% 43%
89Racket 162.01162.0493,596262  0% 1% 1% 100%
153Java  #3 7 min6 min161,212530  24% 26% 26% 24%
218Clojure #2 146.43120.40229,380299  32% 28% 29% 31%
227Clojure 169.27142.85238,440348  32% 27% 28% 29%
274Perl 52 min34 min288,772353  38% 38% 33% 33%
508Erlang 38.4138.39534,164273  0% 0% 1% 99%
509Erlang HiPE 39.7439.73535,360273  0% 99% 0% 1%
571Ruby JRuby 11 min8 min600,696342  29% 27% 27% 29%
665Perl #3 13 min10 min699,072489  53% 54% 7% 8%
Pascal Free Pascal Make Error523
Ruby JRuby #2 Failed228
Rust Bad Output504
Scala Failed296
"wrong" (different) algorithm / less comparable programs
5.1C++ g++ #3 8.268.275,364726
5.3Python 3 #3 10.1210.125,592270
9.1Ada 2005 GNAT #5 0.500.489,5961476
20F# Mono #4 1.751.7521,132267
77Java  #4 40.0736.1980,576894
93Java  #2 4.924.8498,000693
93Java  #5 20.6918.6998,292432
146Java  #6 1.020.95153,228543
missing benchmark programs
Dart No program
Fortran Intel No program
Hack No program
PHP 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