/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 9.929.103,820307  4% 3% 2% 100%
1.6Go #5 14.6014.622,852405  0% 1% 100% 0%
3.7F# Mono #3 34.0834.0929,304329  0% 0% 0% 100%
14Clojure #2 147.90125.34396,744299  41% 42% 16% 15%
14Clojure 149.95125.37407,644348  39% 40% 18% 19%
17Racket 158.66158.6548,884262  1% 0% 0% 100%
19C++ g++ #5 9 min176.552,504652  88% 86% 87% 88%
21C++ g++ #4 9 min189.792,504572  81% 78% 79% 81%
29OCaml #2 5 min264.11676350  9% 45% 45% 9%
29C++ g++ #2 5 min265.444,544588  5% 51% 52% 2%
29ATS 267.91266.674,5321065  1% 38% 38% 1%
30OCaml #3 5 min268.632,984296  5% 50% 51% 4%
30C++ g++ 6 min270.663,012636  9% 57% 57% 4%
31C gcc #2 5 min280.242,428575  18% 29% 29% 16%
33F# Mono #2 13 min5 min42,104555  65% 59% 72% 69%
35Ada 2005 GNAT #4 7 min5 min6,656960  55% 3% 3% 56%
35Ada 2005 GNAT #3 7 min5 min6,652727  2% 58% 58% 2%
36Python 3 #2 7 min5 min6,700288  1% 66% 65% 1%
41Lisp SBCL 8 min6 min53,940618  20% 42% 42% 20%
41Java 7  #3 6 min6 min288,644530  1% 46% 46% 1%
42Ada 2005 GNAT #2 10 min6 min6,652560  1% 72% 73% 1%
48OCaml 9 min7 min7,608282  63% 1% 1% 64%
50C# Mono 13 min7 min18,240476  29% 30% 58% 58%
53Ada 2005 GNAT 14 min8 min6,656602  13% 74% 75% 6%
62Lisp SBCL #2 12 min9 min59,760571  30% 32% 32% 31%
74Perl #3 14 min11 min421,420489  55% 6% 6% 56%
162Ruby 2.0 #2 42 min24 min15,096215  16% 60% 61% 19%
C gcc #3 Failed916
C gcc Make Error487
C gcc #4 Timed Out10 min761
Erlang HiPE Failed273
Pascal Free Pascal Make Error523
Perl Timed Out1h 00 min353
Ruby 2.0 Failed331
Ruby JRuby #2 Failed228
Ruby JRuby Failed342
Scala Failed296
"wrong" (different) algorithm / less comparable programs
0.1Ada 2005 GNAT #5 0.580.556,6561476
0.1Java 7  #6 1.101.16216,212543
0.3F# Mono #4 2.452.4623,140267
0.6Java 7  #2 5.395.28144,056693
1.3Python 3 #3 11.9611.974,568270
1.8C++ g++ #3 16.1816.192,556726
1.9Java 7  #5 19.4217.71100,784432
3.8Java 7  #4 37.6434.68104,948894
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