/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 29 min20 min15,584215  33% 25% 26% 35%
1.2Racket 169.30169.2848,924262  0% 1% 100% 0%
1.3OCaml 11 min8 min7,608282  47% 14% 13% 47%
1.3Python 3 #2 8 min6 min6,268288  20% 20% 33% 33%
1.4OCaml #3 6 min271.733,004296  44% 10% 10% 45%
1.4Clojure #2 138.16120.48381,192299  31% 26% 26% 29%
1.4Haskell GHC 9.909.053,500306  100% 3% 4% 3%
1.5F# Mono #3 19.4819.4827,528329  4% 72% 3% 24%
1.5Ruby 9 min7 min15,592331  22% 32% 33% 21%
1.6Clojure 142.86125.55378,956348  30% 26% 26% 29%
1.6OCaml #2 6 min288.47692350  5% 51% 50% 5%
1.9Go #5 15.8115.812,828405  0% 100% 1% 0%
2.2Java  #7 8 min6 min21,876473  26% 27% 27% 26%
2.2C# Mono 15 min7 min16,244476  42% 43% 42% 57%
2.3C gcc 5 min269.884,544487  11% 36% 36% 11%
2.3Perl #3 14 min11 min421,420489  55% 6% 6% 56%
2.5Java  #3 8 min6 min286,340530  26% 26% 26% 25%
2.6F# Mono #2 12 min293.3638,696555  66% 61% 60% 67%
2.6Ada 2005 GNAT #2 10 min6 min6,924560  14% 50% 50% 14%
2.7Lisp SBCL #2 9 min6 min63,920571  31% 27% 26% 31%
2.7C++ g++ #4 7 min135.412,524572  88% 88% 88% 89%
2.7C gcc #2 5 min266.802,436575  15% 31% 31% 15%
2.7C++ g++ #2 5 min261.004,544588  29% 17% 18% 29%
2.8Ada 2005 GNAT 16 min9 min6,656602  39% 38% 38% 39%
2.9Lisp SBCL 7 min5 min20,388618  28% 24% 23% 30%
3.0C++ g++ 6 min271.543,024636  18% 38% 38% 18%
3.0C++ g++ #5 8 min141.722,524652  87% 87% 87% 88%
3.4Ada 2005 GNAT #3 7 min5 min6,660727  23% 26% 26% 23%
3.5C gcc #4 5 min271.352,432761  35% 24% 27% 35%
4.3C gcc #3 150.71150.772,612916  100% 1% 1% 0%
4.5Ada 2005 GNAT #4 7 min5 min6,656960  14% 37% 37% 14%
Erlang HiPE Failed273
Pascal Free Pascal Make Error523
Perl Timed Out1h 00 min353
Ruby JRuby #2 Failed228
Ruby JRuby Failed342
Rust Bad Output504
Scala Failed296
"wrong" (different) algorithm / less comparable programs
1.2F# Mono #4 1.981.9920,176267
1.3Python 3 #3 11.4511.454,416270
2.0Java  #5 21.1319.14103,060432
2.5Java  #6 1.281.32278,428543
3.2Java  #2 5.415.35228,892693
3.4C++ g++ #3 8.828.832,524726
4.2Java  #4 40.6536.88102,268894
6.9Ada 2005 GNAT #5 0.580.556,6601476
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