The Computer Language
Benchmarks Game

binary-trees

We accept something intermediate between chaos and rigidity — enough flex & slop & play to allow for Haskell programs that are not just mechanically translated from Fortran; enough similarity in the basic workloads & tested results.

Programming language advocates and curious programmers have contributed new programs and introduced newer techniques. Look at the slower simple sequential programs, and  look at the parallel programs written for multicore, and  look at the low-level programs written for SIMD. Always look at the source code.

× source secs mem gz busy cpu load
1.0 Free Pascal #7 3.06 132,852 1003 10.34 100% 89% 70% 80%
1.0 Free Pascal #6 3.10 132,852 959 10.51 90% 88% 71% 91%
1.1 Free Pascal #5 3.31 132,740 953 10.63 89% 70% 71% 91%
1.1 Rust #2 3.33 199,664 721 12.08 87% 100% 88% 87%
1.2 C gcc #2 3.53 168,844 809 11.76 98% 75% 86% 74%
1.2 Rust #4 3.80 173,560 756 13.89 89% 88% 90% 99%
1.2 Rust #3 3.81 149,628 754 13.96 89% 99% 89% 90%
1.3 C gcc #3 3.87 113,356 836 12.62 98% 72% 79% 76%
1.3 C++ g++ #9 3.92 114,136 809 12.90 82% 75% 73% 98%
1.9 C++ g++ #6 5.67 222,004 844 16.46 78% 83% 90% 39%
1.9 C++ g++ #3 5.68 221,956 945 15.91 65% 60% 98% 57%
2.0 C# .NET Core #5 6.05 1,030,984 767 21.45 92% 88% 89% 86%
2.0 C# aot #5 6.15 974,576 767 21.27 86% 86% 85% 88%
2.1 C++ g++ #8 6.33 222,124 820 16.82 54% 53% 68% 91%
2.1 Rust 6.43 133,128 751 23.26 85% 89% 90% 98%
2.3 F# .NET Core #9 6.99 918,992 631 24.34 88% 89% 86% 86%
2.4 F# .NET Core #6 7.44 985,228 611 26.76 92% 89% 89% 89%
2.4 F# .NET Core #8 7.46 917,180 619 26.38 90% 88% 89% 88%
2.6 Java OpenJ9 #7 7.88 424,216 835 26.99 86% 87% 92% 78%
2.7 Erlang HiPE #2 8.18 464,444 478 24.76 87% 72% 72% 71%
2.7 Java  #7 8.32 953,620 835 28.37 95% 87% 81% 77%
2.8 C# aot #4 8.55 891,524 810 29.34 82% 88% 83% 91%
2.9 C++ g++ 8.88 1,979,836 754 32.98 92% 91% 98% 91%
2.9 C# .NET Core #4 8.95 890,228 810 31.11 85% 86% 90% 86%
3.0 Ada 2012 GNAT #4 9.20 202,428 2107 32.49 83% 88% 89% 93%
3.2 Lisp SBCL #3 9.74 377,188 943 22.77 56% 49% 78% 51%
3.2 OCaml #2 9.84 152,916 751 29.09 84% 43% 99% 69%
3.5 Java #4 10.73 721,620 840 13.19 10% 34% 72% 8%
3.6 Java #3 11.05 783,408 540 14.24 74% 13% 11% 32%
3.7 Java #6 11.45 736,212 529 14.11 21% 8% 8% 86%
3.8 Java #2 11.55 779,968 552 14.65 12% 15% 90% 10%
4.2 Haskell GHC #6 12.96 476,448 592 47.98 92% 92% 93% 94%
4.4 Racket CS #3 13.58 409,884 473 13.71 0% 1% 0% 100%
4.8 Chapel #2 14.61 366,656 474 44.44 100% 74% 75% 56%
4.8 C# aot #3 14.63 1,737,716 676 48.16 80% 83% 83% 84%
5.1 C# .NET Core #3 15.59 1,889,664 676 53.34 87% 88% 84% 83%
5.1 F# .NET Core #7 15.65 1,594,380 516 51.22 88% 81% 79% 79%
5.3 Haskell GHC #5 16.12 687,556 561 59.86 92% 91% 93% 95%
5.4 Java OpenJ9 #4 16.61 453,188 840 30.93 43% 36% 39% 68%
5.5 Dart exe #2 16.79 757,560 1410 40.40 67% 63% 53% 57%
5.5 Dart aot #2 16.82 760,064 1410 40.97 63% 60% 60% 61%
5.5 Racket #4 16.93 984,544 853 46.33 93% 57% 69% 55%
5.6 Racket CS #2 17.23 475,896 416 17.38 100% 0% 0% 0%
5.7 Haskell GHC #3 17.57 694,596 538 66.23 95% 93% 93% 96%
5.7 Java OpenJ9 #6 17.58 440,864 529 33.64 67% 65% 31% 29%
5.9 C# aot #2 17.95 749,724 586 20.70 46% 28% 26% 15%
6.0 C gcc #5 18.28 351,452 908 66.05 84% 93% 93% 91%
6.0 Java OpenJ9 #2 18.45 443,068 552 33.99 48% 56% 19% 62%
6.1 C# .NET Core #2 18.53 714,208 586 21.85 19% 49% 38% 12%
6.2 Racket CS #4 18.92 744,860 853 31.70 54% 38% 34% 41%
6.6 Dart snapshot #2 20.29 819,292 1410 45.64 61% 54% 50% 60%
6.8 Dart #2 20.76 808,360 1410 45.56 63% 61% 45% 50%
6.9 Julia #4 21.19 645,680 372 66.24 74% 74% 77% 88%
7.1 OCaml #5 21.79 173,932 461 22.36 0% 1% 2% 100%
7.1 Julia #3 21.84 648,972 470 66.60 72% 87% 74% 71%
7.4 F# .NET Core #3 22.58 856,672 531 26.13 19% 48% 40% 8%
7.6 Node js #6 23.20 1,094,272 744 75.75 84% 82% 80% 80%
7.6 TypeScript #4 23.26 1,076,016 948 75.63 80% 83% 81% 80%
7.8 Haskell GHC 24.01 667,252 494 48.31 33% 59% 75% 33%
7.9 Ada 2012 GNAT #3 24.12 528,324 1266 82.97 85% 84% 84% 92%
7.9 Dart aot 24.16 669,992 457 28.70 42% 11% 12% 55%
7.9 Dart exe 24.16 694,504 457 28.56 32% 53% 18% 16%
8.0 Erlang HiPE 24.55 604,012 420 25.63 87% 3% 3% 12%
8.2 Go #8 25.17 361,152 1005 86.86 87% 89% 86% 84%
8.4 Lisp SBCL 25.77 381,268 589 26.67 27% 1% 3% 73%
8.6 Java OpenJ9 #3 26.34 432,188 540 48.52 71% 63% 12% 38%
8.8 Dart 27.03 754,684 457 31.45 13% 76% 17% 10%
8.8 Go #5 27.04 468,452 950 106.48 99% 99% 98% 99%
9.0 Go #4 27.56 498,500 654 105.58 95% 98% 95% 95%
9.1 Go #2 27.79 479,176 660 106.20 96% 95% 96% 96%
9.2 C# aot 28.02 1,199,544 600 34.15 42% 37% 31% 13%
9.2 C# .NET Core 28.02 1,256,752 600 34.29 25% 41% 44% 12%
9.2 Racket #3 28.19 513,728 473 28.52 0% 100% 1% 0%
9.5 Haskell GHC #2 29.04 455,264 491 60.60 36% 78% 59% 36%
9.5 F# .NET Core 29.06 1,203,940 506 35.05 42% 32% 34% 13%
9.7 Node js #5 29.57 894,544 994 96.90 81% 83% 81% 84%
9.7 Racket #2 29.61 506,624 416 29.85 0% 64% 36% 1%
9.7 Go #3 29.78 1,135,504 640 114.84 96% 96% 98% 96%
10 Dart snapshot 30.29 626,696 457 39.05 85% 22% 11% 10%
10 Node js #4 31.30 574,408 1008 100.49 78% 80% 80% 83%
10 F# .NET Core #4 31.93 1,219,884 488 37.34 29% 34% 37% 17%
11 Racket CS 32.17 640,692 476 32.39 0% 31% 69% 0%
11 VW Smalltalk #3 32.47 376,016 930 81.92 61% 89% 34% 68%
12 Julia #2 37.08 582,548 423 38.00 100% 1% 1% 1%
13 C++ g++ #2 38.37 265,204 508 39.05 1% 1% 0% 100%
13 C gcc 39.96 263,740 654 40.31 100% 1% 0% 0%
13 F# .NET Core #2 40.26 1,394,576 482 46.46 34% 34% 32% 16%
14 Ada 2012 GNAT 42.41 265,452 888 43.36 70% 1% 1% 30%
15 Swift 44.93 733,728 714 133.24 78% 70% 74% 75%
15 Dart exe #3 46.70 1,435,224 1206 91.61 61% 46% 45% 44%
15 Dart aot #3 46.86 1,451,384 1206 93.27 60% 48% 47% 45%
16 Racket 48.16 658,956 476 48.94 70% 1% 1% 30%
17 Node js #3 50.54 703,708 434 92.80 39% 46% 55% 44%
17 PHP #7 50.59 1,584,444 751 182.39 87% 86% 99% 90%
17 TypeScript #2 51.29 693,908 456 94.44 55% 43% 46% 40%
17 TypeScript 51.32 714,352 460 92.33 39% 37% 63% 40%
17 Dart snapshot #3 53.53 1,550,948 1206 99.56 40% 53% 51% 41%
18 Node js 53.61 695,568 440 95.90 41% 55% 42% 41%
18 Dart #3 53.99 1,552,732 1206 98.86 48% 53% 41% 42%
18 Go #9 55.88 257,704 508 101.42 47% 47% 44% 44%
18 Go 56.45 250,400 482 102.27 48% 41% 47% 45%
18 PHP #6 56.49 754,960 868 208.74 91% 91% 90% 97%
19 Julia 57.93 703,952 436 63.95 94% 5% 4% 7%
19 Go #7 57.98 258,268 525 105.76 46% 46% 45% 47%
20 Fortran Intel 60.58 525,624 773 62.46 98% 2% 1% 2%
20 PHP #4 62.16 1,554,328 770 193.52 74% 71% 71% 94%
21 JRuby #5 62.88 2,343,064 1083 223.94 93% 90% 88% 85%
21 Ruby #5 64.75 413,136 1107 221.94 79% 90% 80% 93%
22 Pharo Smalltalk 68.36 384,804 669 69.65 1% 14% 86% 1%
24 PHP #5 73.79 733,236 1040 208.73 84% 93% 59% 48%
25 VW Smalltalk 75.50 375,636 711 76.22 0% 0% 100% 1%
25 Go #6 77.05 372,144 611 79.75 3% 26% 74% 1%
26 Python 3 80.30 448,004 589 286.50 95% 87% 87% 88%
31 JRuby #3 93.83 1,875,888 400 111.42 17% 7% 7% 88%
31 JRuby #4 96.26 1,918,704 364 123.88 28% 33% 29% 39%
32 Ruby #4 98.80 422,824 364 138.99 22% 5% 97% 17%
35 JRuby #2 107.14 2,323,088 378 151.38 60% 24% 16% 42%
36 JRuby 109.14 2,326,024 376 158.71 83% 16% 23% 24%
37 Python 3 #3 113.34 677,608 1238 5 min 72% 61% 93% 64%
45 Ruby 138.06 422,740 376 179.60 16% 69% 33% 12%
45 Ruby #3 138.80 672,388 400 179.53 10% 96% 7% 17%
46 Ruby #2 140.69 422,996 378 184.91 13% 26% 76% 17%
50 PHP #3 153.58 1,557,200 428 156.36 12% 0% 72% 17%
55 PHP 168.54 738,472 451 172.02 16% 0% 0% 85%
56 Perl #3 172.50 2,200,640 648 9 min 72% 87% 73% 100%
60 PHP #2 182.03 743,760 423 186.16 3% 1% 98% 1%
83 Python 3 #2 254.66 274,564 338 258.71 80% 0% 0% 20%
137 Perl 6 min 599,248 395 7 min 99% 0% 1% 1%
153 Lua #2 7 min 2,358,616 412 7 min 1% 1% 100% 0%
415 Matz's Ruby #3 21 min 839,888 400 21 min 60% 0% 40% 0%
566 Matz's Ruby #4 28 min 1,558,556 364 29 min 100% 0% 1% 0%
598 Matz's Ruby #2 30 min 1,558,496 378 30 min 11% 1% 1% 88%
600 Matz's Ruby 30 min 1,558,448 376 30 min 77% 1% 1% 24%
F# .NET Core #5 Bad Output
Fortran Intel #2 Failed
Haskell GHC #4 Bad Output
Lisp SBCL #2 Bad Output
Matz's Ruby #5 Failed
Swift #9 Bad Output