The Computer Language
Benchmarks Game

binary-trees

program source code, command-line and measurements

× source secs mem gz cpu cpu load
1.0 C++ g++ #9 2.36 114,404 809 7.69 86% 71% 87% 85%
1.0 C gcc #3 2.38 131,728 836 7.70 98% 87% 73% 68%
1.8 C++ g++ #6 4.17 265,420 844 12.32 90% 75% 100% 36%
1.8 C++ g++ #3 4.23 265,132 945 10.75 71% 53% 54% 80%
2.0 Rust #2 4.66 184,704 717 17.32 92% 91% 91% 100%
2.0 C++ g++ #8 4.73 265,496 820 13.62 41% 100% 67% 84%
2.1 Swift #9 4.90 192,756 997 13.74 99% 60% 62% 62%
2.3 Fortran Intel #2 5.50 119,140 1148 16.35 64% 64% 100% 71%
2.9 Rust 6.83 148,320 746 24.01 78% 89% 99% 89%
3.1 C# .NET Core #5 7.26 716,568 851 23.98 84% 82% 81% 87%
3.3 Ada 2005 GNAT #4 7.72 202,276 2101 23.33 70% 79% 90% 68%
3.3 Ada 2005 GNAT #5 7.75 202,308 2101 23.62 69% 96% 78% 66%
3.3 C# .NET Core #4 7.86 724,552 780 25.56 89% 81% 82% 78%
3.4 Erlang HiPE #2 8.05 571,444 478 27.34 96% 81% 81% 84%
3.8 C++ g++ 8.87 1,824,860 754 33.68 95% 95% 95% 99%
4.2 OCaml #2 9.82 115,804 746 28.90 90% 96% 39% 72%
4.6 Hack #4 10.87 508,460 736 36.47 87% 98% 74% 79%
4.8 Java  #7 11.26 593,156 835 39.02 85% 88% 90% 88%
6.1 Chapel 14.32 324,660 484 44.15 100% 58% 78% 75%
6.3 Java #3 14.94 521,004 540 26.03 26% 31% 57% 63%
6.4 Java #6 15.13 520,676 529 26.95 69% 56% 28% 28%
6.6 Erlang #2 15.51 511,840 478 53.73 88% 83% 91% 86%
6.6 C# .NET Core #3 15.66 1,866,012 676 49.48 79% 82% 78% 80%
6.7 Java #2 15.73 542,932 552 29.06 35% 36% 66% 52%
7.2 Java #4 17.09 714,012 840 34.22 46% 36% 73% 49%
7.5 C# .NET Core #2 17.82 835,196 586 20.17 12% 43% 44% 17%
8.7 C gcc #5 20.52 353,080 908 77.16 96% 95% 94% 92%
8.9 Erlang HiPE 21.05 483,332 420 21.05 1% 1% 1% 99%
9.6 F# .NET Core #3 22.63 844,248 531 24.99 45% 20% 10% 38%
9.7 OCaml #5 22.99 151,700 456 22.96 1% 100% 0% 1%
11 Haskell GHC 25.26 673,076 494 52.88 43% 93% 38% 38%
11 Haskell GHC #3 25.29 713,176 538 53.09 38% 38% 90% 48%
11 Ada 2005 GNAT #3 26.40 527,976 1263 96.45 91% 90% 90% 96%
11 Lisp SBCL 26.56 538,328 594 26.51 1% 100% 1% 0%
11 Racket #3 26.96 501,036 473 26.92 1% 1% 1% 100%
12 Haskell GHC #2 27.73 458,712 486 53.94 45% 41% 65% 72%
12 C# .NET Core 28.21 1,171,628 600 32.68 54% 14% 22% 28%
12 Racket #2 28.32 500,936 416 28.28 1% 100% 0% 1%
12 F# .NET Core 28.87 1,130,320 506 33.84 22% 52% 17% 28%
13 Smalltalk VW #3 31.15 375,020 938 83.72 59% 78% 64% 71%
13 F# .NET Core #4 31.24 950,008 488 35.22 19% 44% 23% 28%
13 Hack #3 31.25 507,332 425 31.21 1% 1% 100% 0%
15 Go #4 34.77 269,068 654 132.04 95% 97% 95% 95%
15 Go #2 35.07 275,868 660 133.58 95% 96% 97% 95%
15 C gcc 35.57 263,492 654 35.54 1% 1% 100% 0%
15 Go #5 35.86 272,704 950 140.11 98% 98% 98% 98%
15 Pascal Free Pascal 36.18 262,180 705 36.15 1% 0% 1% 100%
16 C++ g++ #2 37.33 264,900 508 37.30 0% 100% 1% 0%
16 Dart 37.72 555,108 457 48.13 25% 22% 56% 26%
16 F# .NET Core #2 38.60 988,172 475 42.80 30% 26% 29% 27%
17 Ada 2005 GNAT 40.62 265,408 881 40.59 1% 1% 0% 100%
19 Swift 45.36 737,300 714 134.14 90% 68% 69% 71%
19 Erlang 45.95 521,296 420 45.94 100% 1% 1% 0%
20 Racket 47.51 625,888 476 47.44 1% 100% 0% 1%
23 Ruby #5 54.24 510,868 1078 153.99 73% 98% 67% 72%
23 Node.js 54.38 948,260 440 55.52 19% 27% 55% 2%
26 Fortran Intel 61.39 263,844 773 61.34 100% 0% 0% 1%
26 Ruby JRuby #5 62.06 1,693,060 1078 230.50 92% 93% 95% 94%
27 Go #9 63.49 288,524 508 103.46 43% 38% 46% 38%
28 Go 65.70 283,056 482 105.81 43% 39% 43% 38%
28 Go #7 66.59 279,408 525 108.84 42% 42% 47% 34%
29 TypeScript #2 69.52 956,612 448 70.64 9% 58% 9% 27%
30 TypeScript 70.02 954,504 451 71.08 9% 5% 25% 64%
32 Smalltalk VW 76.03 375,100 725 75.93 0% 100% 1% 0%
37 Python 3 86.90 451,548 581 5 min 89% 97% 87% 89%
37 PHP #5 88.07 736,372 1027 247.49 92% 77% 23% 91%
41 Ruby JRuby #3 95.75 1,319,804 400 125.48 26% 72% 24% 30%
41 Ruby JRuby #4 96.80 1,725,928 364 142.04 20% 80% 31% 19%
44 Ruby JRuby 103.56 1,790,696 376 162.56 23% 37% 76% 23%
44 Ruby JRuby #2 104.13 1,772,576 378 159.13 23% 54% 52% 26%
56 Hack #2 132.52 1,162,428 422 132.41 2% 1% 0% 100%
61 Ruby #4 144.64 562,464 364 144.49 1% 22% 78% 2%
62 Hack 145.46 1,160,496 451 145.33 100% 1% 1% 0%
76 Ruby #2 179.00 563,084 378 178.84 1% 100% 0% 2%
76 Ruby 180.01 563,124 376 179.85 67% 1% 34% 1%
79 Ruby #3 186.48 434,456 400 186.32 2% 0% 100% 1%
84 Perl #3 197.93 2,133,108 641 10 min 68% 71% 92% 96%
102 PHP #3 241.44 1,551,556 428 241.24 100% 0% 1% 0%
112 PHP 263.74 734,416 451 263.49 3% 100% 2% 3%
112 Python 3 #2 265.47 274,404 338 265.33 1% 0% 100% 1%
117 PHP #4 275.97 1,551,680 762 5 min 93% 92% 88% 92%
153 PHP #2 6 min 734,364 423 6 min 100% 2% 3% 2%
154 Lua #2 6 min 2,194,388 412 6 min 38% 28% 36% 1%
192 Perl 7 min 598,556 395 7 min 19% 13% 48% 21%
F# .NET Core #5 Bad Output
Haskell GHC #4 Bad Output
Lisp SBCL #2 Bad Output