The Computer Language
Benchmarks Game

binary-trees

program source code, command-line and measurements

× source secs mem gz cpu cpu load
1.0 C gcc #3 2.44 133,956 836 7.57 80% 65% 68% 100%
1.0 C++ g++ #9 2.55 135,568 809 7.99 85% 96% 69% 66%
1.8 C++ g++ #6 4.41 226,000 844 11.00 37% 70% 90% 55%
1.9 C++ g++ #3 4.54 231,608 945 11.89 56% 76% 94% 38%
2.1 Swift #9 5.05 192,172 1001 14.17 60% 60% 63% 100%
2.1 C++ g++ #8 5.19 221,456 820 13.56 71% 98% 55% 40%
2.4 Fortran Intel #2 5.84 115,892 1148 17.30 63% 68% 66% 100%
2.6 Rust 6.36 119,720 751 21.40 94% 77% 78% 90%
3.1 Erlang HiPE #2 7.63 399,604 478 23.32 71% 77% 85% 73%
3.4 C# .NET Core #4 8.26 877,360 810 26.13 80% 80% 81% 79%
3.4 Ada 2005 GNAT #5 8.27 202,500 2107 26.49 93% 80% 73% 80%
3.4 Java  #7 8.39 933,808 835 28.28 82% 86% 84% 88%
3.5 Ada 2005 GNAT #4 8.42 202,576 2107 26.61 84% 74% 90% 73%
3.5 Lisp SBCL #3 8.49 369,508 943 21.44 62% 62% 77% 58%
3.5 C++ g++ 8.50 1,810,688 754 31.39 97% 92% 92% 92%
3.5 F# .NET Core #8 8.54 1,049,740 619 28.64 87% 88% 83% 82%
3.6 F# .NET Core #6 8.81 1,055,608 611 28.84 82% 81% 85% 83%
4.1 OCaml #2 10.03 115,968 751 30.17 89% 89% 82% 44%
4.5 Hack #4 10.90 351,656 742 34.16 86% 87% 81% 63%
5.1 Java #4 12.37 786,092 840 16.91 45% 39% 25% 30%
5.1 Java #3 12.50 826,544 540 16.04 38% 8% 15% 68%
5.2 Java #6 12.66 871,440 529 16.13 12% 83% 23% 12%
5.3 Java #2 12.92 842,424 552 16.43 23% 66% 22% 18%
5.8 Chapel 14.15 298,452 484 43.74 100% 77% 76% 58%
6.2 C# .NET Core #3 15.23 1,905,176 676 49.15 89% 79% 80% 78%
7.0 F# .NET Core #7 17.00 1,220,380 516 51.18 78% 79% 79% 81%
7.3 C# .NET Core #2 17.81 817,300 586 19.53 37% 27% 32% 15%
7.8 C gcc #5 19.05 351,304 908 68.47 91% 80% 98% 91%
8.8 Erlang HiPE 21.46 554,100 420 21.63 45% 11% 45% 2%
9.2 F# .NET Core #3 22.53 819,252 531 24.89 12% 16% 14% 70%
9.3 OCaml #5 22.79 151,984 461 22.76 100% 1% 1% 1%
10 Ada 2005 GNAT #3 24.97 528,180 1266 84.88 83% 90% 84% 83%
10 Haskell GHC 25.13 711,956 494 52.23 91% 37% 36% 45%
11 Haskell GHC #2 27.53 453,912 491 55.83 96% 35% 35% 38%
12 Racket #3 28.31 493,956 473 28.29 0% 0% 0% 100%
12 C# .NET Core 28.54 1,169,000 600 32.77 30% 31% 37% 20%
12 F# .NET Core 28.59 1,041,376 506 33.03 30% 27% 22% 38%
12 Go #4 28.80 434,632 654 109.58 94% 95% 95% 97%
12 Racket #2 29.81 501,312 416 29.78 0% 1% 100% 0%
12 Hack #3 30.02 351,104 425 29.99 27% 74% 1% 1%
12 Go #2 30.23 414,780 660 115.73 97% 95% 96% 96%
13 VW Smalltalk #3 31.15 375,020 938 83.72 59% 78% 64% 71%
13 F# .NET Core #4 31.65 982,168 488 36.18 22% 26% 30% 37%
13 Go #5 32.10 407,804 950 127.22 99% 99% 99% 99%
15 Go #3 35.71 874,404 640 137.77 99% 96% 97% 95%
15 C++ g++ #2 36.21 265,092 508 36.19 100% 1% 1% 0%
15 Free Pascal 36.42 262,180 715 36.40 100% 1% 1% 0%
15 C gcc 37.09 263,700 654 37.06 0% 1% 0% 100%
16 Dart 38.02 550,668 457 48.65 27% 63% 31% 8%
16 F# .NET Core #2 38.25 1,104,908 482 42.89 27% 29% 18% 40%
17 Ada 2005 GNAT 41.33 265,428 888 41.31 0% 45% 56% 0%
18 TypeScript #2 44.51 658,776 448 80.41 61% 39% 38% 44%
18 TypeScript 44.57 658,672 451 80.40 46% 35% 43% 57%
19 Node js 45.39 658,324 440 81.91 37% 39% 59% 46%
19 Swift 46.70 737,460 714 139.69 72% 63% 70% 95%
20 Ruby #5 47.66 511,724 1083 137.38 66% 90% 70% 63%
20 Racket 49.22 619,480 476 49.17 0% 35% 66% 0%
23 Go 55.80 265,700 482 97.60 43% 46% 46% 41%
23 Go #9 56.29 257,972 508 97.47 41% 48% 41% 45%
24 Go #7 58.12 256,892 525 101.85 46% 42% 45% 43%
26 JRuby #5 63.73 2,333,064 1083 235.59 95% 94% 95% 94%
27 PHP #6 65.20 736,468 868 235.57 93% 94% 92% 98%
27 Fortran Intel 65.64 250,956 773 65.60 0% 6% 95% 0%
31 VW Smalltalk 76.03 375,100 725 75.93 0% 100% 1% 0%
32 PHP #5 79.01 736,908 1040 222.04 91% 95% 0% 95%
35 PHP #7 85.02 1,551,888 751 197.60 87% 71% 77% 81%
37 JRuby #3 91.37 1,868,412 400 107.62 17% 43% 26% 33%
38 Python 3 93.55 280,624 589 5 min 92% 89% 87% 93%
38 JRuby #4 93.77 1,772,816 364 172.77 40% 40% 61% 44%
43 JRuby 105.59 2,330,784 376 175.31 27% 22% 61% 57%
44 JRuby #2 106.73 2,332,304 378 176.76 26% 25% 55% 63%
46 PHP #4 112.74 1,552,072 770 5 min 67% 89% 70% 71%
52 Ruby #4 127.91 547,416 364 127.78 0% 1% 1% 100%
62 Hack #2 152.20 614,752 422 152.10 6% 95% 1% 1%
68 Hack 166.09 614,816 451 165.98 8% 61% 34% 3%
70 Ruby 171.00 549,480 376 170.86 1% 1% 0% 100%
74 Ruby #2 179.44 561,492 378 179.32 13% 88% 0% 0%
75 Ruby #3 182.39 433,576 400 182.26 80% 21% 0% 0%
75 Perl #3 183.13 2,199,432 648 10 min 83% 93% 77% 81%
91 Truffle Ruby #4 220.85 1,207,848 364 10 min 72% 68% 74% 74%
92 PHP #3 223.82 1,551,796 428 223.65 5% 13% 19% 66%
94 PHP 228.50 734,884 451 228.33 29% 0% 0% 72%
102 Truffle Ruby #3 248.69 1,177,716 400 12 min 73% 71% 74% 76%
111 Truffle Ruby #2 271.36 1,176,568 378 13 min 71% 72% 82% 77%
126 Python 3 #2 5 min 275,916 338 5 min 0% 14% 87% 0%
132 PHP #2 5 min 734,856 423 5 min 0% 77% 23% 1%
177 Perl 7 min 598,628 395 7 min 9% 1% 1% 91%
192 Lua #2 7 min 2,312,236 412 7 min 59% 1% 1% 42%
521 Matz's Ruby #3 21 min 839,728 400 21 min 25% 0% 0% 76%
717 Matz's Ruby #4 29 min 1,558,692 364 29 min 18% 2% 10% 71%
  Matz's Ruby #2 30 min 1,558,396 378 30 min 35% 17% 1% 49%
  Matz's Ruby 30 min 1,558,300 376 30 min 80% 21% 1% 1%
F# .NET Core #5 Bad Output
Haskell GHC #6 Make Error
Haskell GHC #5 Make Error
Haskell GHC #3 Make Error
Haskell GHC #4 Bad Output
Lisp SBCL #2 Timed Out
Lisp SBCL Timed Out
Matz's Ruby #5 Failed
Truffle Ruby #5 Failed
Truffle Ruby Failed
Rust #2 Make Error