/mobile Handheld Friendly website

 thread-ring benchmark N=50,000,000

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

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.

    sortsortsort 
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0Ruby 2.0 #2 47 min26 min18,784215  66% 9% 21% 67%
1.2Racket 154.04154.1280,900262  0% 0% 43% 58%
1.3Erlang 38.4138.39534,164273  0% 0% 1% 99%
1.3Erlang HiPE 39.7439.73535,360273  0% 99% 0% 1%
1.3OCaml 10 min8 min13,636282  58% 5% 4% 58%
1.3Python 3 #2 7 min5 min10,328288  2% 62% 62% 2%
1.4OCaml #3 5 min249.105,524296  56% 3% 2% 56%
1.4Clojure #2 127.85112.31391,080299  29% 27% 26% 29%
1.4Haskell GHC 11.539.383,264307  8% 7% 8% 100%
1.5F# Mono #3 76.9153.7017,524329  23% 47% 43% 27%
1.6Ruby JRuby 10 min7 min574,068342  4% 4% 58% 57%
1.6Clojure 138.91123.33395,152348  29% 27% 26% 27%
1.6OCaml #2 5 min258.311,036350  49% 6% 7% 50%
1.6Perl 52 min34 min288,772353  38% 38% 33% 33%
1.9Go #5 12.8612.863,376405  0% 0% 0% 100%
2.2C# Mono 14 min7 min19,848476  41% 51% 50% 39%
2.3C gcc 298.26222.994,620487  42% 10% 10% 42%
2.3Perl #3 13 min10 min699,072489  53% 54% 7% 8%
2.5Java 7  #3 6 min6 min290,292530  8% 36% 36% 8%
2.6F# Mono #2 20 min8 min21,588555  63% 64% 64% 63%
2.6Ada 2005 GNAT #2 8 min5 min9,844560  20% 45% 46% 19%
2.7Lisp SBCL #2 7 min5 min31,436571  40% 22% 22% 40%
2.7C++ g++ #4 10 min195.445,356572  80% 80% 80% 80%
2.7C++ g++ #2 5 min229.414,620588  35% 15% 15% 35%
2.8Ada 2005 GNAT 13 min7 min9,856602  47% 35% 33% 47%
2.9Lisp SBCL 6 min273.0831,444618  64% 1% 1% 65%
3.0C++ g++ 5 min241.095,328636  34% 23% 23% 34%
3.0C++ g++ #5 9 min189.745,360652  81% 79% 79% 81%
3.4Ada 2005 GNAT #3 6 min286.189,856727  21% 31% 32% 20%
3.5C gcc #4 5 min234.614,616761  34% 16% 17% 33%
4.3C gcc #3 150.34150.424,528916  100% 0% 0% 0%
4.5Ada 2005 GNAT #4 6 min284.909,856960  54% 3% 3% 54%
5.0ATS 258.04259.624,6041065  5% 4% 32% 32%
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
1.2F# Mono #4 1.901.8916,244267
1.3Python 3 #3 10.3910.406,352270
2.0Java 7  #5 18.6316.89142,128432
2.5Java 7  #6 0.930.91248,344543
3.2Java 7  #2 4.914.80144,732693
3.4C++ g++ #3 14.7414.755,360726
4.2Java 7  #4 37.6534.61141,736894
6.9Ada 2005 GNAT #5 0.510.499,5961476
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