The Computer Language
Benchmarks Game

binary-trees

program source code, command-line and measurements

× source secs KB gz cpu cpu load
1.0 C gcc #3 3.28 156,780 906 10.12 91% 77% 59% 83%
1.6 Ada 2005 GNAT #5 5.33 160,616 2167 17.40 90% 77% 91% 73%
1.6 Ada 2005 GNAT #4 5.40 160,604 2167 17.32 88% 71% 91% 75%
1.7 Swift #9 5.47 251,028 1062 16.57 72% 65% 96% 72%
1.8 Fortran Intel #2 5.98 185,288 1199 18.25 73% 72% 69% 95%
2.2 C++ g++ #6 7.23 362,820 892 24.45 53% 92% 100% 96%
2.3 Rust 7.51 220,396 792 27.26 98% 77% 96% 94%
2.4 C++ g++ #3 7.74 362,676 993 26.36 88% 97% 71% 87%
2.4 C++ g++ #8 7.83 362,732 852 25.72 95% 77% 96% 89%
3.5 Java  #7 11.52 643,924 889 40.54 89% 92% 85% 89%
4.1 Java #2 13.34 514,440 603 18.81 46% 19% 39% 39%
4.1 Java #3 13.37 513,400 584 18.98 67% 22% 29% 26%
4.1 C++ g++ 13.44 2,941,392 796 51.97 99% 97% 97% 97%
4.1 Scala #4 13.60 531,348 494 19.40 29% 40% 58% 18%
4.2 Java #6 13.77 511,632 583 19.28 76% 18% 17% 31%
4.2 Clojure #2 13.81 615,132 750 45.65 85% 83% 88% 76%
4.4 C# .NET Core #4 14.28 827,036 955 50.72 89% 90% 90% 90%
4.4 Java #4 14.43 586,292 911 22.96 24% 64% 34% 41%
4.6 F# .NET Core #4 15.16 694,768 511 16.81 70% 22% 9% 12%
4.8 Chapel 15.65 341,416 554 51.70 100% 81% 80% 71%
4.9 F# .NET Core 15.95 709,332 537 18.20 32% 27% 29% 28%
5.6 Clojure 18.49 616,160 657 28.16 33% 45% 37% 49%
6.1 Clojure #6 19.89 609,624 705 32.28 43% 49% 29% 43%
6.2 Erlang HiPE #2 20.32 968,816 499 64.90 71% 77% 82% 92%
6.3 Haskell GHC #4 20.83 817,104 612 65.44 72% 92% 80% 72%
6.4 C gcc #5 21.14 221,620 963 79.62 88% 97% 97% 97%
6.6 C# .NET Core #3 21.58 2,959,832 725 68.57 84% 80% 79% 78%
6.9 Lisp SBCL #2 22.59 322,012 649 22.55 1% 0% 100% 1%
7.1 OCaml #2 23.42 173,568 784 70.56 84% 90% 77% 55%
8.2 Lisp SBCL 26.82 323,784 612 26.78 12% 1% 1% 88%
8.5 Haskell GHC 28.02 360,468 521 54.58 33% 96% 35% 33%
8.7 Ada 2005 GNAT #3 28.58 658,776 1342 99.60 90% 86% 87% 87%
9.1 Erlang #2 29.83 821,676 499 112.32 93% 93% 93% 99%
10 C# .NET Core 33.28 1,677,692 652 41.52 45% 32% 12% 37%
11 Hack #3 35.88 638,536 480 35.84 98% 2% 1% 1%
11 F# .NET Core #2 36.22 749,944 515 40.80 38% 28% 37% 15%
11 Dart 36.49 356,988 503 45.11 38% 43% 24% 21%
11 C# .NET Core #2 37.05 1,200,248 650 41.50 45% 15% 29% 26%
11 Racket #2 37.10 420,556 640 37.04 1% 1% 1% 100%
12 Pascal Free Pascal 38.12 131,376 769 38.09 1% 0% 100% 1%
12 C gcc 38.37 132,440 706 38.33 100% 1% 1% 0%
12 Erlang HiPE 38.99 1,043,472 441 38.98 1% 97% 0% 4%
12 C++ g++ #2 39.12 199,680 553 39.08 2% 0% 100% 1%
12 OCaml #5 39.26 260,788 496 39.20 100% 1% 0% 0%
12 Go #4 39.68 364,612 688 150.64 95% 95% 95% 96%
12 Ada 2005 GNAT 39.74 199,920 955 39.70 1% 0% 1% 100%
12 F# .NET Core #3 39.92 1,143,996 565 45.94 43% 48% 11% 16%
12 Go #2 40.29 379,664 694 153.98 96% 96% 95% 96%
13 Go #5 41.38 377,668 1000 163.80 99% 99% 99% 99%
14 Racket 45.56 478,324 495 45.49 1% 0% 0% 100%
14 Swift 46.25 574,232 792 141.14 88% 71% 71% 81%
17 Node.js 55.64 895,396 477 56.61 3% 52% 43% 5%
17 TypeScript #2 56.22 890,440 470 57.12 70% 2% 2% 30%
17 TypeScript 56.23 890,184 475 57.19 9% 39% 46% 10%
18 Ruby #5 58.72 192,132 1123 166.36 67% 61% 68% 90%
19 Fortran Intel 62.48 137,376 826 62.42 100% 0% 1% 1%
23 Go #9 77.08 278,044 548 121.15 39% 42% 41% 40%
25 Go 80.60 258,940 516 125.00 40% 43% 37% 37%
25 Smalltalk VW 81.30 331,144 722 81.20 1% 1% 0% 100%
25 Go #7 82.05 289,024 567 131.42 43% 42% 37% 39%
27 Hack #2 88.25 769,568 468 88.16 100% 1% 1% 1%
27 Erlang 89.30 907,220 441 89.22 52% 1% 1% 49%
32 PHP #4 103.82 ? 1161 ? 85% 88% 92% 75%
33 Hack 106.85 769,656 506 106.76 89% 12% 1% 1%
38 Python 3 126.07 831,740 596 7 min 93% 93% 93% 99%
49 Ruby #4 160.43 207,264 402 160.29 1% 100% 0% 0%
53 Ruby JRuby #3 174.71 1,540,044 439 249.90 18% 88% 23% 20%
53 PHP #3 175.09 1,550,168 483 174.93 98% 4% 1% 0%
54 Ruby JRuby #4 177.49 2,082,864 402 281.39 30% 32% 27% 71%
55 Scala #5 182.01 518,896 688 6 min 57% 59% 59% 56%
58 Ruby 191.21 476,880 412 191.05 68% 1% 1% 33%
58 Ruby #2 191.62 423,792 413 191.46 37% 1% 64% 1%
60 Ruby #3 197.95 495,740 439 197.78 36% 57% 9% 1%
61 Ruby JRuby #5 199.39 2,243,540 1123 12 min 97% 97% 97% 96%
65 Perl #3 213.12 1,385,276 706 11 min 97% 72% 96% 72%
70 PHP #2 230.68 440,540 472 230.46 1% 100% 0% 1%
71 Ruby JRuby 233.32 2,302,868 412 8 min 44% 80% 49% 42%
73 PHP 238.11 440,464 504 237.90 0% 1% 1% 100%
127 Lua #2 6 min 1,716,904 446 6 min 21% 13% 68% 1%
160 Perl 8 min 351,036 448 8 min 47% 1% 10% 44%