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.2 Rust 3.78 130,596 791 13.17 95% 77% 89% 90%
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.9 Fortran Intel #2 6.08 185,084 1199 19.18 100% 70% 76% 72%
2.1 C++ g++ #7 6.98 150,512 846 6.97 100% 0% 0% 1%
2.4 C++ g++ #3 7.74 362,676 993 26.36 88% 97% 71% 87%
3.5 Java  #7 11.51 622,328 889 40.10 86% 86% 92% 87%
3.5 Scala #2 11.52 686,532 641 36.29 85% 87% 72% 73%
3.9 C++ g++ #6 12.86 298,088 892 12.84 1% 100% 1% 1%
4.1 Java #2 13.34 516,836 603 18.69 40% 25% 26% 52%
4.1 Java #3 13.36 517,024 584 18.99 19% 37% 28% 60%
4.1 Java #6 13.41 515,676 583 18.69 72% 19% 30% 21%
4.1 C++ g++ 13.44 2,941,392 796 51.97 99% 97% 97% 97%
4.1 Scala #4 13.53 520,808 494 18.84 46% 35% 36% 25%
4.2 Clojure #2 13.81 615,132 750 45.65 85% 83% 88% 76%
4.4 Java #4 14.57 589,976 911 23.24 24% 77% 22% 37%
5.6 Clojure 18.49 616,160 657 28.16 33% 45% 37% 49%
6.0 Chapel 19.83 264,492 554 64.40 100% 83% 80% 64%
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%
7.2 F# Mono LLVM 23.50 160,992 537 25.42 9% 100% 1% 1%
7.5 Lisp SBCL #2 24.50 354,192 649 24.45 1% 100% 1% 1%
7.9 OCaml #2 25.82 173,372 784 77.00 89% 95% 54% 64%
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%
8.7 Lisp SBCL 28.63 323,480 612 28.57 41% 63% 1% 3%
9.1 Erlang #2 29.83 821,676 499 112.32 93% 93% 93% 99%
11 Hack #3 35.00 652,736 480 34.96 1% 0% 1% 100%
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 Ada 2005 GNAT 39.74 199,920 955 39.70 1% 0% 1% 100%
12 Go #4 39.88 361,208 688 152.12 96% 95% 96% 96%
12 Go #2 40.09 369,124 694 153.61 97% 95% 96% 96%
13 Go #5 41.35 384,112 1000 157.64 96% 96% 96% 96%
13 OCaml #5 41.55 263,260 496 41.49 1% 100% 1% 1%
13 Dart 42.13 521,828 503 58.72 30% 70% 22% 19%
14 Racket 45.56 478,324 495 45.49 1% 0% 0% 100%
14 F# Mono LLVM #3 47.51 256,192 565 51.09 0% 9% 1% 100%
16 Node.js 52.79 954,084 477 53.92 11% 9% 80% 6%
16 C# Mono LLVM #2 54.12 454,164 650 57.80 100% 0% 8% 2%
16 TypeScript #2 54.12 955,356 470 55.26 2% 1% 100% 2%
17 TypeScript 54.21 955,816 475 55.44 20% 2% 2% 81%
17 C# Mono LLVM 55.04 273,112 652 59.98 77% 1% 29% 7%
18 Ruby #5 57.98 243,912 1123 168.33 96% 65% 68% 64%
19 Swift #6 61.94 104,424 490 61.90 1% 0% 100% 1%
19 C# .NET Core #2 62.48 543,156 650 68.62 62% 12% 27% 10%
19 F# Mono LLVM #2 63.21 278,484 515 68.03 9% 0% 100% 1%
21 Fortran Intel 68.17 134,076 826 68.14 1% 100% 0% 0%
21 C# .NET Core 68.34 1,395,888 652 72.78 64% 6% 29% 10%
24 Go #9 77.66 295,608 548 122.54 38% 41% 41% 41%
24 Go 78.52 281,036 516 123.97 36% 44% 43% 36%
24 Go #7 80.25 286,480 567 129.82 42% 46% 39% 38%
25 Smalltalk VW 81.30 331,144 722 81.20 1% 1% 0% 100%
27 Erlang 89.30 907,220 441 89.22 52% 1% 1% 49%
29 Swift #3 95.25 202,664 484 95.17 100% 1% 2% 1%
29 Swift 96.18 202,656 491 96.09 1% 0% 100% 1%
29 Hack #2 96.58 783,792 468 96.51 0% 1% 100% 1%
35 Hack 114.69 783,808 506 114.61 39% 37% 25% 1%
43 Scala #5 140.66 482,360 688 6 min 72% 71% 70% 72%
45 C# .NET Core #3 148.60 1,531,860 725 187.67 28% 30% 32% 39%
46 Ruby JRuby #3 149.36 1,444,868 439 204.64 19% 25% 68% 26%
46 Python 3 152.06 804,624 596 8 min 94% 92% 95% 91%
47 Ruby #4 155.62 243,484 402 155.46 0% 30% 70% 0%
51 Ruby JRuby #4 168.13 2,049,520 402 264.77 32% 55% 42% 33%
53 Ruby JRuby #5 173.69 2,295,976 1123 11 min 97% 96% 96% 95%
53 PHP #3 175.09 1,550,168 483 174.93 98% 4% 1% 0%
61 Ruby 200.83 432,092 412 200.65 59% 0% 0% 42%
63 Ruby #2 206.69 432,132 413 206.50 18% 61% 1% 22%
63 Ruby #3 207.76 575,052 439 207.53 48% 5% 40% 10%
65 Perl #3 213.12 1,385,276 706 11 min 97% 72% 96% 72%
69 Ruby JRuby 227.79 2,303,556 412 8 min 42% 61% 67% 47%
70 PHP #2 230.68 440,540 472 230.46 1% 100% 0% 1%
73 PHP 238.11 440,464 504 237.90 0% 1% 1% 100%
86 C# Mono LLVM #3 282.03 1,259,240 725 16 min 89% 87% 86% 86%
129 Lua #2 7 min 1,724,000 446 7 min 42% 21% 4% 34%
160 Perl 8 min 351,036 448 8 min 47% 1% 10% 44%
Lisp SBCL #3 Bad Output
Swift #5 Make Error
Swift #4 Make Error