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.1 C++ g++ #7 3.47 182,972 846 10.56 87% 93% 64% 64%
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%
1.9 Swift #8 6.28 239,944 815 17.74 98% 58% 59% 71%
2.2 C++ g++ #6 7.23 362,820 892 24.45 53% 92% 100% 96%
2.3 Rust 7.54 218,564 792 27.86 95% 82% 95% 99%
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%
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.2 Scala #4 13.71 527,684 494 19.66 21% 53% 30% 42%
4.2 Clojure #2 13.81 615,132 750 45.65 85% 83% 88% 76%
4.4 C# .NET Core #4 14.31 760,568 955 50.52 89% 88% 89% 91%
4.4 Java #4 14.57 589,976 911 23.24 24% 77% 22% 37%
4.7 F# .NET Core #4 15.36 457,128 511 17.05 24% 32% 41% 17%
4.8 Chapel 15.65 341,416 554 51.70 100% 81% 80% 71%
5.0 F# .NET Core 16.29 680,880 537 18.17 46% 43% 18% 7%
5.6 Clojure 18.49 616,160 657 28.16 33% 45% 37% 49%
6.0 C# .NET Core #3 19.73 3,040,468 725 66.74 86% 87% 85% 84%
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.9 Lisp SBCL #2 22.59 322,012 649 22.55 1% 0% 100% 1%
7.9 OCaml #2 25.82 173,372 784 77.00 89% 95% 54% 64%
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%
9.9 Swift #7 32.48 167,980 619 104.96 98% 61% 97% 69%
10 C# .NET Core 33.29 1,809,480 652 41.13 35% 24% 27% 40%
11 Hack #3 34.81 443,884 480 34.76 1% 99% 0% 1%
11 Racket #2 37.10 420,556 640 37.04 1% 1% 1% 100%
11 C# .NET Core #2 37.12 1,130,276 650 41.29 24% 22% 13% 58%
11 F# .NET Core #2 37.34 682,888 515 41.92 43% 19% 44% 8%
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 F# .NET Core #3 39.67 1,122,296 565 45.24 65% 32% 9% 9%
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.55 355,172 503 60.50 26% 28% 29% 60%
14 Racket 45.56 478,324 495 45.49 1% 0% 0% 100%
16 C# Mono LLVM #2 54.12 454,164 650 57.80 100% 0% 8% 2%
17 C# Mono LLVM 55.04 273,112 652 59.98 77% 1% 29% 7%
17 Node.js 55.75 973,012 477 57.04 1% 62% 9% 32%
17 TypeScript #2 56.06 970,572 470 57.31 2% 2% 4% 97%
17 TypeScript 56.45 966,416 475 57.78 57% 1% 44% 2%
18 Ruby #5 57.98 243,912 1123 168.33 96% 65% 68% 64%
18 Swift #6 59.89 104,452 490 59.85 100% 0% 1% 1%
21 Fortran Intel 68.17 134,076 826 68.14 1% 100% 0% 0%
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%
26 C# Mono LLVM #4 86.58 313,192 955 210.45 63% 64% 61% 61%
27 Erlang 89.30 907,220 441 89.22 52% 1% 1% 49%
30 Hack #2 97.14 766,324 468 97.05 100% 0% 1% 1%
32 PHP #4 103.82 ? 1161 ? 85% 88% 92% 75%
33 Hack 108.37 766,084 506 108.24 27% 1% 0% 74%
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%
54 Scala #5 178.71 523,028 688 6 min 52% 63% 63% 51%
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
Scala #2 Failed