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.37 199,768 721 12.27 88% 88% 100% 88%
1.1 C gcc #2 3.48 168,744 809 11.47 99% 74% 79% 79%
1.2 Rust #4 3.70 159,892 756 13.67 91% 89% 91% 99%
1.2 C gcc #3 3.72 117,896 836 11.84 85% 77% 71% 85%
1.2 Rust #3 3.77 162,536 754 13.83 89% 89% 100% 89%
1.2 C++ g++ #9 3.79 117,164 809 12.28 99% 76% 75% 74%
1.8 Fortran Intel #2 5.44 112,944 1148 15.82 66% 63% 72% 90%
1.8 C++ g++ #3 5.61 221,692 945 14.84 77% 56% 90% 42%
1.9 C++ g++ #6 5.70 221,908 844 16.74 90% 80% 83% 41%
2.0 Rust 6.23 133,132 751 22.34 85% 94% 90% 90%
2.0 C++ g++ #8 6.24 221,896 820 16.91 91% 69% 57% 54%
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.86 426,392 835 26.95 78% 82% 96% 87%
2.6 Erlang HiPE #2 8.03 454,164 478 23.79 83% 78% 69% 66%
2.7 Java  #7 8.29 966,764 835 27.76 86% 80% 86% 83%
2.9 C++ g++ 8.87 1,999,716 754 32.98 92% 97% 92% 91%
2.9 C# .NET Core #4 8.95 890,228 810 31.11 85% 86% 90% 86%
3.2 Ada 2012 GNAT #4 9.64 202,248 2107 33.29 82% 84% 90% 89%
3.3 OCaml #2 10.01 152,708 751 29.55 69% 87% 56% 83%
3.5 Java #4 10.78 721,616 840 13.52 10% 9% 8% 98%
3.8 Java #3 11.65 779,892 540 14.33 7% 95% 10% 11%
3.9 Java #2 11.86 784,032 552 14.46 7% 43% 63% 9%
3.9 Java #6 11.87 785,252 529 14.42 80% 8% 17% 16%
3.9 Lisp SBCL #3 11.94 309,372 943 25.35 68% 48% 45% 51%
4.0 Java OpenJ9 #3 12.33 524,628 540 19.03 27% 20% 19% 89%
4.2 Racket CS #3 12.94 373,376 473 13.36 100% 1% 2% 0%
4.4 Haskell GHC #6 13.34 466,176 592 49.53 95% 93% 92% 91%
4.7 Chapel #2 14.31 366,428 474 44.27 100% 76% 76% 58%
4.8 Racket CS #2 14.76 300,948 416 15.03 1% 1% 0% 100%
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 Dart aot #2 16.22 794,024 1410 40.33 69% 61% 57% 62%
5.4 Java OpenJ9 #4 16.63 452,856 840 31.83 80% 60% 17% 35%
5.5 Haskell GHC #5 16.91 633,968 561 62.89 92% 89% 96% 94%
5.6 Haskell GHC #3 17.24 704,788 538 64.43 93% 94% 93% 94%
5.7 Java OpenJ9 #6 17.46 441,860 529 32.40 57% 34% 79% 16%
5.8 Dart snapshot #2 17.77 830,768 1410 42.95 67% 50% 63% 63%
5.9 Dart #2 18.09 863,916 1410 43.61 51% 73% 59% 57%
6.0 Java OpenJ9 #2 18.42 439,164 552 33.77 45% 54% 17% 67%
6.0 C gcc #5 18.45 351,424 908 66.16 78% 92% 90% 98%
6.1 C# .NET Core #2 18.53 714,208 586 21.85 19% 49% 38% 12%
6.2 Racket CS #4 19.02 801,040 853 38.04 47% 55% 59% 40%
6.3 Racket #4 19.37 1,091,760 853 63.19 97% 82% 65% 82%
7.1 OCaml #5 21.63 173,600 461 21.97 1% 0% 100% 1%
7.4 F# .NET Core #3 22.58 856,672 531 26.13 19% 48% 40% 8%
7.5 Erlang HiPE 23.03 617,764 420 23.83 9% 24% 53% 17%
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.6 Dart aot 23.39 741,764 457 26.74 9% 82% 15% 9%
7.8 Julia #4 23.88 634,308 372 78.75 92% 79% 80% 79%
8.0 Dart snapshot 24.33 839,184 457 28.36 11% 17% 81% 8%
8.0 Julia #3 24.37 650,504 470 78.32 74% 78% 94% 75%
8.1 Racket #3 24.90 463,388 473 50.78 76% 100% 1% 27%
8.3 Dart 25.28 870,760 457 29.62 12% 12% 8% 86%
8.3 Go #8 25.40 370,688 1005 87.09 86% 86% 86% 85%
8.5 Ada 2012 GNAT #3 25.87 528,064 1266 84.31 88% 80% 78% 79%
8.6 Haskell GHC 26.16 667,268 494 49.39 69% 60% 30% 30%
8.7 Racket #2 26.66 471,576 416 53.64 1% 100% 0% 100%
8.9 Go #5 27.09 502,160 950 106.69 99% 98% 98% 99%
9.1 Go #4 27.70 482,476 654 105.78 97% 94% 96% 94%
9.1 Go #2 27.74 504,220 660 105.46 95% 94% 95% 96%
9.1 Haskell GHC #2 27.88 454,912 491 56.55 56% 35% 63% 48%
9.2 C# .NET Core 28.02 1,256,752 600 34.29 25% 41% 44% 12%
9.3 Lisp SBCL 28.56 367,768 589 29.08 100% 1% 1% 0%
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.8 Go #3 29.99 1,142,472 640 114.93 95% 96% 97% 95%
10 Node js #4 31.30 574,408 1008 100.49 78% 80% 80% 83%
10 VW Smalltalk #3 31.84 375,672 930 81.59 92% 72% 62% 30%
10 F# .NET Core #4 31.93 1,219,884 488 37.34 29% 34% 37% 17%
11 Racket CS 33.06 616,268 476 34.21 2% 100% 0% 1%
12 C++ g++ #2 37.73 265,160 508 38.15 0% 0% 100% 1%
13 C gcc 39.78 263,776 654 40.13 100% 0% 1% 0%
13 F# .NET Core #2 40.26 1,394,576 482 46.46 34% 34% 32% 16%
14 Ada 2012 GNAT 43.59 265,392 888 43.87 100% 0% 0% 0%
15 Dart aot #3 44.57 1,503,840 1206 90.08 48% 60% 46% 48%
15 Swift 45.43 733,576 714 134.65 68% 63% 91% 74%
15 Dart snapshot #3 46.77 1,617,440 1206 90.61 44% 48% 45% 56%
15 Dart #3 47.23 1,591,108 1206 92.33 49% 50% 54% 42%
16 Racket 48.43 642,112 476 97.63 19% 100% 1% 82%
17 PHP #7 50.51 1,584,428 751 182.85 96% 91% 91% 85%
17 Node js #3 50.54 703,708 434 92.80 39% 46% 55% 44%
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%
18 Node js 53.61 695,568 440 95.90 41% 55% 42% 41%
18 Go #9 55.98 258,860 508 101.81 44% 48% 45% 45%
18 Go 56.35 257,656 482 102.73 44% 46% 46% 47%
19 PHP #6 57.59 788,836 868 213.19 91% 91% 91% 97%
19 Go #7 58.19 257,692 525 106.32 52% 43% 44% 44%
20 Julia #2 59.90 652,792 423 71.12 9% 7% 5% 98%
20 PHP #4 60.87 1,554,320 770 189.32 67% 72% 86% 86%
20 Fortran Intel 60.94 525,624 773 63.34 10% 92% 2% 0%
20 JRuby #5 61.23 2,344,956 1083 220.60 93% 88% 92% 88%
21 Ruby #5 64.75 413,136 1107 221.94 79% 90% 80% 93%
22 Pharo Smalltalk 68.40 361,140 669 69.56 51% 1% 1% 49%
24 PHP #5 73.32 789,828 1040 210.79 64% 91% 91% 42%
25 Go #6 77.26 365,380 611 80.02 3% 1% 98% 2%
25 VW Smalltalk 77.88 375,396 711 78.99 1% 0% 100% 1%
26 Python 3 80.71 448,276 589 288.85 87% 88% 87% 96%
29 JRuby #4 89.83 2,162,204 364 111.12 10% 30% 74% 10%
30 JRuby #3 93.22 1,818,072 400 110.59 74% 7% 7% 30%
32 Julia 96.38 704,132 436 99.85 2% 1% 1% 100%
32 Ruby #4 98.80 422,824 364 138.99 22% 5% 97% 17%
36 JRuby #2 109.26 2,330,856 378 158.14 21% 18% 18% 88%
37 JRuby 114.52 2,327,532 376 168.55 19% 85% 24% 19%
38 Python 3 #3 116.77 677,736 1238 5 min 61% 60% 100% 65%
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 152.83 1,557,284 428 154.99 1% 0% 0% 100%
56 PHP 170.05 738,516 451 172.87 0% 100% 1% 0%
58 Perl #3 175.97 2,202,756 648 9 min 100% 68% 93% 67%
60 PHP #2 182.28 743,752 423 185.44 1% 1% 0% 100%
79 Python 3 #2 243.05 274,324 338 249.23 100% 0% 1% 1%
136 Perl 6 min 598,892 395 7 min 51% 43% 1% 8%
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
Haskell GHC #4 Bad Output
Lisp SBCL #2 Bad Output
Matz's Ruby #5 Failed
Swift #9 Bad Output