/mobile Handheld Friendly website

 thread-ring benchmark N=50,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.0Haskell GHC 11.539.383,264307  8% 7% 8% 100%
1.4Go #5 12.8612.863,376405  0% 0% 0% 100%
4.1Erlang 38.4138.39534,164273  0% 0% 1% 99%
4.2Erlang HiPE 39.7439.73535,360273  0% 99% 0% 1%
5.7F# Mono #3 76.9153.7017,524329  23% 47% 43% 27%
12Clojure #2 127.85112.31391,080299  29% 27% 26% 29%
13Clojure 138.91123.33395,152348  29% 27% 26% 27%
16C gcc #3 150.34150.424,528916  100% 0% 0% 0%
16Racket 154.04154.1280,900262  0% 0% 43% 58%
20C++ g++ #5 9 min189.745,360652  81% 79% 79% 81%
21C++ g++ #4 10 min195.445,356572  80% 80% 80% 80%
24C gcc 298.26222.994,620487  42% 10% 10% 42%
24C++ g++ #2 5 min229.414,620588  35% 15% 15% 35%
25C gcc #4 5 min234.614,616761  34% 16% 17% 33%
26C++ g++ 5 min241.095,328636  34% 23% 23% 34%
27OCaml #3 5 min249.105,524296  56% 3% 2% 56%
28OCaml #2 5 min258.311,036350  49% 6% 7% 50%
28ATS 258.04259.624,6041065  5% 4% 32% 32%
29Lisp SBCL 6 min273.0831,444618  64% 1% 1% 65%
30Ada 2005 GNAT #4 6 min284.909,856960  54% 3% 3% 54%
31Ada 2005 GNAT #3 6 min286.189,856727  21% 31% 32% 20%
34Lisp SBCL #2 7 min5 min31,436571  40% 22% 22% 40%
36Ada 2005 GNAT #2 8 min5 min9,844560  20% 45% 46% 19%
36Python 3 #2 7 min5 min10,328288  2% 62% 62% 2%
39Java 7  #3 6 min6 min290,292530  8% 36% 36% 8%
48Ada 2005 GNAT 13 min7 min9,856602  47% 35% 33% 47%
48C# Mono 14 min7 min19,848476  41% 51% 50% 39%
50Ruby JRuby 10 min7 min574,068342  4% 4% 58% 57%
53F# Mono #2 20 min8 min21,588555  63% 64% 64% 63%
53OCaml 10 min8 min13,636282  58% 5% 4% 58%
66Perl #3 13 min10 min699,072489  53% 54% 7% 8%
167Ruby 2.0 #2 47 min26 min18,784215  66% 9% 21% 67%
221Perl 52 min34 min288,772353  38% 38% 33% 33%
C gcc #2 Make Error575
Pascal Free Pascal Make Error523
Ruby 2.0 Failed331
Ruby JRuby #2 Failed228
Scala Failed296
"wrong" (different) algorithm / less comparable programs
0.1Ada 2005 GNAT #5 0.510.499,5961476
0.1Java 7  #6 0.930.91248,344543
0.2F# Mono #4 1.901.8916,244267
0.5Java 7  #2 4.914.80144,732693
1.1Python 3 #3 10.3910.406,352270
1.6C++ g++ #3 14.7414.755,360726
1.8Java 7  #5 18.6316.89142,128432
3.7Java 7  #4 37.6534.61141,736894
missing benchmark programs
Dart No program
Fortran Intel 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