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 152.51152.621,052350  0% 0% 0% 100%
3.0Go #5 11.3511.353,148405  1% 0% 1% 100%
3.1Haskell GHC 7.137.143,220306  0% 1% 1% 100%
4.4C gcc #2 215.93216.094,608575  0% 1% 0% 100%
5.1C++ g++ 5 min5 min5,328636  0% 1% 1% 100%
5.3OCaml #3 152.05152.165,540296  0% 0% 0% 100%
6.3C gcc 214.59214.756,584487  1% 1% 1% 100%
6.3C++ g++ #2 213.08213.226,588588  0% 1% 1% 100%
8.2C gcc #3 273.09273.288,612916  100% 1% 1% 0%
8.3C gcc #4 212.43212.568,704761  0% 1% 1% 100%
9.0C++ g++ #5 8.488.499,444652  0% 1% 0% 100%
9.0C++ g++ #4 9.239.249,448572  1% 0% 1% 100%
9.3Python 3 #2 212.64212.789,832288  0% 1% 1% 100%
14OCaml 6 min6 min14,212282  0% 0% 0% 100%
17Ada 2005 GNAT #2 7 min7 min17,788560  1% 1% 0% 100%
17Ada 2005 GNAT #3 291.26291.4618,020727  1% 0% 0% 100%
17Ada 2005 GNAT #4 293.85294.0518,020960  1% 0% 0% 100%
19Ada 2005 GNAT #6 10.4210.4319,6081015  0% 3% 2% 100%
19Ruby 247.18247.3419,792331  1% 0% 1% 100%
19Ada 2005 GNAT 10 min10 min19,800602  1% 0% 1% 100%
30C# Mono 229.34229.5032,076476  0% 0% 1% 100%
37C# Mono #2 5 min5 min39,252591  0% 1% 1% 100%
40Rust 225.71225.8741,712342  1% 1% 1% 100%
41Smalltalk VisualWorks #2 42.9242.9543,644566  0% 0% 0% 100%
43F# Mono #3 16.3916.4045,140329  1% 1% 1% 100%
45Java  #7 220.79220.9447,644473  1% 1% 1% 100%
83Racket 144.21144.3287,148262  0% 0% 1% 100%
348Java  #3 228.30228.45365,860530  0% 1% 1% 100%
390Clojure 84.5384.64410,660348  1% 1% 0% 100%
392Clojure #2 78.4678.56412,804299  1% 1% 1% 100%
425Lisp SBCL #2 5 min5 min447,620571  1% 1% 1% 100%
508Erlang HiPE 9.709.71534,424273  0% 1% 1% 100%
1,568Ruby JRuby 7 min7 min1,650,000342  0% 1% 1% 100%
F# Mono #2 Failed555
Lisp SBCL Timed Out10 min618
Pascal Free Pascal Make Error523
Perl #3 Failed489
Perl Failed353
Ruby #2 Bad Output215
Ruby JRuby #2 Failed228
Scala Failed296
"wrong" (different) algorithm / less comparable programs
1.5Lua #3 17.4417.451,540264
5.3Python 3 #3 10.1110.125,596270
9.0C++ g++ #3 9.269.279,444726
17Ada 2005 GNAT #5 0.490.5017,7761476
27F# Mono #4 1.851.8528,784267
195Java  #6 0.940.95204,796543
267Java  #2 4.844.85280,396693
275Java  #5 18.7118.73288,932432
346Java  #4 39.2339.26364,488894
missing benchmark programs
Dart No program
Fortran Intel No program
Hack No program
JavaScript V8 No program
Lua No program
PHP No program

 thread-ring benchmark : Switch from thread to thread passing one token

You can write your own program for this task and contribute to the benchmarks game by following these general instructions.

More specifically:

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