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.34 104,212 809 7.58 85% 88% 83% 70%
1.0 C gcc #3 2.39 102,772 836 7.69 74% 85% 68% 98%
1.8 C++ g++ #3 4.14 265,108 945 10.76 92% 84% 38% 49%
1.8 Rust #2 4.27 184,600 714 15.84 98% 92% 92% 92%
1.8 C++ g++ #6 4.28 265,360 844 11.49 48% 51% 82% 90%
2.0 C++ g++ #8 4.59 265,344 820 11.96 79% 100% 36% 49%
2.1 Swift #9 4.85 193,524 997 13.61 60% 61% 69% 91%
2.3 Fortran Intel #2 5.32 123,092 1148 15.82 68% 74% 92% 67%
3.0 Rust 7.10 148,180 746 24.90 92% 89% 89% 83%
3.3 Ada 2005 GNAT #5 7.74 202,208 2101 23.40 95% 69% 77% 70%
3.4 Ada 2005 GNAT #4 7.85 202,224 2101 23.69 67% 92% 70% 78%
3.4 Erlang HiPE #2 8.05 571,444 478 27.34 96% 81% 81% 84%
3.6 Haskell GHC 8.44 6,380 480 8.51 98% 1% 2% 1%
3.8 C++ g++ 8.98 1,961,380 754 33.90 98% 95% 94% 95%
4.5 OCaml #2 10.46 115,644 746 31.92 50% 71% 99% 89%
4.8 C# .NET Core #4 11.18 718,008 780 31.04 68% 68% 71% 74%
4.8 Java  #7 11.33 592,668 835 39.39 84% 92% 83% 91%
6.4 Scala #4 15.00 555,580 470 26.02 39% 28% 80% 29%
6.5 Java #3 15.15 538,756 540 28.14 32% 39% 51% 67%
6.5 Java #6 15.29 519,028 529 26.78 52% 44% 52% 29%
6.6 Erlang #2 15.51 511,840 478 53.73 88% 83% 91% 86%
6.7 Chapel 15.69 323,028 505 47.99 100% 74% 55% 78%
6.7 Java #2 15.75 540,472 552 27.32 32% 72% 44% 27%
7.3 C# .NET Core #2 17.02 829,908 586 18.63 37% 57% 13% 6%
7.3 Java #4 17.10 704,684 840 33.97 36% 67% 48% 50%
7.6 C# .NET Core #3 17.82 2,248,728 676 56.59 78% 87% 77% 78%
9.0 Erlang HiPE 21.05 483,332 420 21.05 1% 1% 1% 99%
9.0 Clojure 21.16 702,672 643 34.42 49% 25% 53% 37%
9.0 C gcc #5 21.18 353,208 908 78.52 93% 98% 86% 95%
9.8 F# .NET Core #3 22.84 834,184 531 25.10 55% 19% 34% 4%
11 OCaml #5 25.92 151,584 456 25.88 100% 1% 1% 0%
11 Lisp SBCL 26.35 541,820 594 26.29 49% 4% 55% 3%
12 F# .NET Core 28.60 933,312 506 32.75 69% 11% 11% 24%
13 C# .NET Core 30.11 1,185,832 600 37.12 40% 40% 20% 27%
13 Ada 2005 GNAT #3 30.75 527,908 1263 96.95 75% 81% 86% 75%
13 Hack #3 31.25 507,332 425 31.21 1% 1% 100% 0%
15 F# .NET Core #4 34.13 571,764 488 42.38 30% 46% 23% 27%
15 Go #2 34.64 274,340 660 132.43 95% 96% 97% 96%
15 Go #4 34.84 260,948 654 132.55 97% 95% 95% 95%
15 C gcc 35.95 263,668 654 35.91 0% 0% 0% 100%
16 C++ g++ #2 36.50 264,836 508 36.47 1% 0% 100% 1%
16 Pascal Free Pascal 36.62 262,180 705 36.58 1% 0% 100% 1%
16 Go #5 37.19 272,044 950 140.14 95% 95% 94% 95%
16 F# .NET Core #2 38.29 1,108,780 475 41.80 40% 8% 34% 28%
17 Ada 2005 GNAT 39.75 265,380 881 39.72 0% 1% 100% 0%
18 Dart 42.11 486,740 457 56.27 68% 32% 20% 16%
19 Racket 45.25 634,896 476 45.18 0% 100% 1% 1%
20 Erlang 45.95 521,296 420 45.94 100% 1% 1% 0%
20 Swift 46.72 736,372 714 137.26 96% 72% 71% 57%
21 Node.js 50.22 927,540 440 51.07 6% 15% 77% 6%
22 TypeScript #2 50.94 929,308 448 51.76 4% 40% 58% 1%
22 TypeScript 51.20 932,940 451 52.01 2% 41% 59% 1%
23 Ruby #5 54.24 510,868 1078 153.99 73% 98% 67% 72%
26 Fortran Intel 61.87 259,876 773 61.80 1% 1% 32% 70%
26 Ruby JRuby #5 62.06 1,693,060 1078 230.50 92% 93% 95% 94%
27 Go #9 64.30 271,812 508 103.90 43% 41% 40% 40%
28 Go 65.37 284,484 482 104.37 40% 40% 43% 38%
29 Go #7 67.02 284,696 525 108.43 45% 41% 44% 33%
32 Smalltalk VW 75.98 374,740 658 75.87 10% 53% 39% 1%
37 Python 3 87.21 453,060 581 5 min 92% 88% 94% 90%
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%
57 Hack #2 132.52 1,162,428 422 132.41 2% 1% 0% 100%
62 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%
77 Ruby 180.01 563,124 376 179.85 67% 1% 34% 1%
77 Scala #5 181.28 591,536 652 7 min 59% 60% 60% 59%
80 Ruby #3 186.48 434,456 400 186.32 2% 0% 100% 1%
85 Perl #3 197.93 2,133,108 641 10 min 68% 71% 92% 96%
120 Python 3 #2 281.81 274,352 338 281.65 14% 52% 0% 35%
150 PHP #2 5 min 733,408 423 5 min 1% 100% 1% 1%
156 Lua #2 6 min 2,194,388 412 6 min 38% 28% 36% 1%
156 PHP 6 min 733,348 451 6 min 2% 83% 16% 1%
172 PHP #3 6 min 3,092,684 428 6 min 99% 2% 3% 5%
194 Perl 7 min 598,556 395 7 min 19% 13% 48% 21%
Clojure #2 Bad Output
Clojure #6 Bad Output
Haskell GHC #4 Bad Output
Lisp SBCL #2 Bad Output
PHP #4 Bad Output
Racket #2 Bad Output