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 Rust #4 3.26 152,504 756 11.97 99% 90% 89% 89%
1.1 Free Pascal #5 3.31 132,740 953 10.63 89% 70% 71% 91%
1.1 Rust #2 3.46 199,352 721 12.65 90% 100% 88% 88%
1.1 C gcc #2 3.48 168,744 809 11.47 99% 74% 79% 79%
1.2 Rust #3 3.55 166,760 754 12.99 97% 92% 89% 88%
1.2 C gcc #3 3.72 117,896 836 11.84 85% 77% 71% 85%
1.2 C++ g++ #9 3.79 117,164 809 12.28 99% 76% 75% 74%
1.8 Fortran Intel #2 5.45 113,000 1148 16.07 62% 65% 77% 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.02 133,116 751 21.84 97% 87% 89% 89%
2.0 C++ g++ #8 6.24 221,896 820 16.91 91% 69% 57% 54%
2.6 F# .NET Core #9 8.03 1,044,600 631 26.86 85% 89% 80% 81%
2.6 Erlang HiPE #2 8.03 454,164 478 23.79 83% 78% 69% 66%
2.6 C# .NET Core #4 8.05 805,016 810 26.80 83% 79% 82% 89%
2.7 F# .NET Core #6 8.11 1,126,184 611 28.49 94% 83% 90% 85%
2.7 Java  #7 8.28 907,060 835 27.59 86% 90% 80% 77%
2.8 F# .NET Core #8 8.55 1,069,996 619 29.33 92% 84% 84% 83%
2.9 C++ g++ 8.87 1,999,716 754 32.98 92% 97% 92% 91%
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.6 Java #3 11.00 770,852 540 13.51 8% 88% 16% 11%
3.6 Java #4 11.13 736,496 840 13.68 63% 11% 7% 42%
3.8 Java #2 11.56 735,024 552 14.28 52% 17% 10% 45%
3.9 Java #6 11.87 708,172 529 14.56 10% 34% 70% 8%
3.9 Lisp SBCL #3 11.94 309,372 943 25.35 68% 48% 45% 51%
4.2 Racket CS #3 12.94 373,376 473 13.36 100% 1% 2% 0%
4.4 Haskell GHC #6 13.52 493,528 592 50.12 92% 90% 92% 97%
4.7 Dart aot #2 14.28 885,140 1410 41.13 81% 71% 74% 62%
4.7 Chapel #2 14.35 361,836 470 46.65 100% 58% 76% 91%
4.8 Racket CS #2 14.76 300,948 416 15.03 1% 1% 0% 100%
4.9 C# .NET Core #3 15.04 2,532,752 676 51.47 84% 92% 82% 83%
5.2 Dart snapshot #2 15.93 933,304 1410 43.90 66% 63% 63% 84%
5.3 Dart #2 16.27 935,556 1410 44.56 88% 64% 61% 61%
5.4 F# .NET Core #7 16.50 1,439,576 516 49.22 77% 79% 73% 69%
5.6 Haskell GHC #3 17.22 704,312 538 65.06 94% 97% 92% 95%
5.7 Haskell GHC #5 17.54 635,256 561 65.34 91% 92% 93% 96%
6.0 C gcc #5 18.45 351,424 908 66.16 78% 92% 90% 98%
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%
6.3 C# .NET Core #2 19.37 821,084 586 21.81 6% 48% 55% 4%
6.7 Substrate VM #7 20.36 718,500 835 42.84 34% 50% 52% 75%
7.0 Substrate VM #3 21.49 659,316 540 21.71 100% 0% 0% 1%
7.1 OCaml #5 21.63 173,600 461 21.97 1% 0% 100% 1%
7.1 Substrate VM #2 21.73 659,344 552 21.88 0% 0% 100% 0%
7.3 Substrate VM #6 22.40 659,196 529 22.72 0% 1% 100% 1%
7.4 F# .NET Core #3 22.66 822,832 531 25.09 16% 46% 39% 11%
7.5 Erlang HiPE 23.03 617,764 420 23.83 9% 24% 53% 17%
7.6 Substrate VM #4 23.11 671,284 840 23.58 100% 0% 1% 1%
7.6 TypeScript #4 23.19 1,062,840 948 75.94 82% 80% 85% 81%
7.7 Dart aot 23.44 790,388 457 27.18 97% 10% 7% 2%
7.9 Julia #4 24.25 645,876 372 77.77 93% 76% 74% 77%
8.0 Julia #3 24.47 646,188 470 76.94 72% 77% 93% 72%
8.1 Dart snapshot 24.81 824,104 457 28.76 91% 8% 9% 9%
8.1 Dart 24.89 896,844 457 29.23 7% 77% 22% 11%
8.1 Racket #3 24.90 463,388 473 50.78 76% 100% 1% 27%
8.3 Go #8 25.25 374,780 1013 87.65 87% 88% 86% 86%
8.5 Ada 2012 GNAT #3 25.87 528,064 1266 84.31 88% 80% 78% 79%
8.6 Haskell GHC #2 26.40 455,192 491 56.19 91% 43% 39% 41%
8.7 Haskell GHC 26.51 667,196 494 51.48 31% 58% 73% 32%
8.7 Racket #2 26.66 471,576 416 53.64 1% 100% 0% 100%
8.9 Go #5 27.36 498,196 950 107.79 98% 99% 99% 98%
9.1 Go #4 27.78 502,336 654 106.31 96% 97% 95% 95%
9.2 Go #2 28.01 488,668 660 106.57 95% 96% 95% 95%
9.2 C# .NET Core 28.22 1,179,240 600 32.73 18% 46% 36% 17%
9.3 F# .NET Core 28.42 1,086,880 506 32.92 25% 45% 35% 11%
9.3 Lisp SBCL 28.56 367,768 589 29.08 100% 1% 1% 0%
9.5 Node js #5 29.10 593,664 994 95.65 81% 85% 80% 82%
9.9 Go #3 30.25 1,162,824 640 115.90 97% 95% 97% 94%
10 Node js #4 31.14 884,260 1008 99.89 81% 79% 82% 79%
10 VW Smalltalk #3 31.84 375,672 930 81.59 92% 72% 62% 30%
10 F# .NET Core #4 31.98 893,556 488 36.63 20% 42% 42% 11%
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 F# .NET Core #2 39.29 942,472 482 43.09 29% 28% 29% 24%
13 C gcc 39.78 263,776 654 40.13 100% 0% 1% 0%
14 Ada 2012 GNAT 43.59 265,392 888 43.87 100% 0% 0% 0%
15 Swift 45.22 733,972 714 135.66 95% 68% 70% 68%
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 51.04 731,812 434 94.40 39% 45% 59% 41%
17 TypeScript #2 51.24 734,944 456 95.39 40% 47% 55% 44%
17 TypeScript 52.32 719,300 460 98.04 42% 53% 45% 47%
18 Node js 53.75 708,188 440 94.98 43% 48% 52% 34%
19 Julia #2 57.10 706,236 423 57.90 99% 1% 1% 1%
19 Go 57.40 290,352 482 102.13 48% 38% 44% 48%
19 Go #9 57.53 291,484 508 105.08 47% 49% 47% 40%
19 PHP #6 57.59 788,836 868 213.19 91% 91% 91% 97%
19 Go #7 59.19 289,404 525 105.09 44% 39% 51% 43%
20 PHP #4 60.87 1,554,320 770 189.32 67% 72% 86% 86%
20 Fortran Intel 61.05 525,624 773 61.67 0% 100% 0% 1%
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 VW Smalltalk 77.88 375,396 711 78.99 1% 0% 100% 1%
26 Python 3 81.03 451,324 589 288.46 95% 87% 86% 88%
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%
31 Julia 95.99 707,440 436 97.30 1% 100% 1% 0%
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%
40 Go #6 122.12 517,216 611 141.62 77% 12% 13% 13%
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%
61 Truffle Ruby #4 186.73 1,459,764 364 8 min 58% 73% 79% 56%
76 Truffle Ruby #3 232.34 1,821,288 400 10 min 63% 84% 68% 65%
78 Truffle Ruby #2 237.29 1,757,524 378 11 min 74% 62% 63% 80%
80 Python 3 #2 244.42 274,016 338 247.89 0% 98% 1% 2%
82 Truffle Ruby 251.32 1,684,372 376 11 min 73% 66% 73% 72%
131 Truffle Ruby #5 6 min 1,488,368 1107 25 min 96% 95% 95% 95%
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