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.6 Rust #2 3.88 173,136 721 14.24 90% 91% 100% 90%
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.0 Erlang HiPE #3 4.95 290,556 473 15.10 75% 74% 80% 78%
2.0 Swift #9 4.98 190,896 1001 14.01 61% 100% 63% 60%
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.4 Rust 5.95 128,344 751 20.92 83% 91% 91% 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.34 893,008 835 28.20 87% 79% 96% 81%
3.5 Ada 2005 GNAT #4 8.42 202,576 2107 26.61 84% 74% 90% 73%
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%
4.6 Java #4 11.15 785,268 840 15.75 83% 11% 26% 24%
4.8 Lisp SBCL #3 11.63 311,372 943 24.25 77% 49% 47% 44%
5.0 Java #3 12.13 838,216 540 15.71 51% 15% 12% 54%
5.0 Java #2 12.24 837,280 552 15.81 9% 30% 79% 14%
5.2 Java #6 12.70 843,536 529 16.40 60% 14% 13% 45%
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%
9.7 Haskell GHC #5 23.66 666,636 561 51.29 56% 42% 66% 55%
10 Haskell GHC #3 24.81 512,320 538 51.11 35% 39% 98% 36%
10 Haskell GHC 24.83 667,016 494 51.11 36% 50% 86% 36%
10 Ada 2005 GNAT #3 24.97 528,180 1266 84.88 83% 90% 84% 83%
11 Racket #3 26.96 501,036 473 26.92 1% 1% 1% 100%
11 Haskell GHC #2 26.98 454,176 491 55.05 58% 36% 36% 77%
12 Racket #2 28.32 500,936 416 28.28 1% 100% 0% 1%
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 Lisp SBCL 29.78 375,296 594 29.74 0% 1% 100% 0%
12 Hack #3 30.02 351,104 425 29.99 27% 74% 1% 1%
13 Smalltalk VW #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%
14 Go #4 34.42 268,188 654 130.26 96% 94% 95% 94%
14 Go #2 34.56 277,648 660 132.54 97% 95% 96% 95%
15 C++ g++ #2 36.21 265,092 508 36.19 100% 1% 1% 0%
15 Pascal 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 Go #5 37.91 290,380 950 142.75 94% 95% 93% 95%
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%
16 Go #3 39.35 600,472 640 151.98 97% 97% 98% 95%
17 Ada 2005 GNAT 41.33 265,428 888 41.31 0% 45% 56% 0%
18 TypeScript #2 44.87 657,788 591 81.58 36% 40% 66% 41%
18 TypeScript 45.07 657,596 595 81.85 45% 38% 36% 63%
19 Node.js 45.67 657,468 440 81.85 45% 39% 39% 58%
19 Swift 46.48 737,616 714 138.23 95% 71% 72% 60%
19 Racket 47.51 625,888 476 47.44 1% 100% 0% 1%
22 Ruby #5 54.24 510,868 1078 153.99 73% 98% 67% 72%
27 Go #9 65.00 282,872 508 105.28 41% 39% 42% 41%
27 Go 65.32 277,432 482 106.12 43% 42% 37% 41%
27 Fortran Intel 65.64 250,956 773 65.60 0% 6% 95% 0%
28 Ruby JRuby #5 67.41 2,442,336 1078 227.30 91% 86% 82% 80%
28 Go #7 68.33 282,516 525 110.32 41% 42% 43% 36%
31 Smalltalk VW 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%
37 Ruby JRuby #3 90.25 1,933,560 400 106.08 57% 10% 9% 46%
38 Python 3 93.55 280,624 589 5 min 92% 89% 87% 93%
41 Ruby JRuby #4 100.38 1,895,548 364 123.41 10% 36% 71% 9%
45 Ruby JRuby #2 110.01 2,445,784 378 213.46 54% 49% 43% 57%
46 PHP #4 112.74 1,552,072 770 5 min 67% 89% 70% 71%
46 Ruby JRuby 112.95 2,436,368 376 165.85 24% 40% 45% 41%
59 Ruby #4 144.64 562,464 364 144.49 1% 22% 78% 2%
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%
73 Ruby #2 179.00 563,084 378 178.84 1% 100% 0% 2%
74 Ruby 180.01 563,124 376 179.85 67% 1% 34% 1%
75 Perl #3 183.13 2,199,432 648 10 min 83% 93% 77% 81%
76 Ruby #3 186.48 434,456 400 186.32 2% 0% 100% 1%
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%
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%
536 Ruby MRI #3 21 min 839,892 400 21 min 23% 20% 30% 29%
735 Matz's Interpreter #4 29 min 1,558,800 364 29 min 0% 3% 8% 91%
  Matz's Interpreter 31 min 1,558,452 376 31 min 1% 31% 56% 13%
  Matz's Interpreter #2 31 min 1,558,476 378 31 min 15% 52% 12% 22%
F# .NET Core #5 Bad Output
Haskell GHC #4 Bad Output
Lisp SBCL #2 Bad Output
Matz's Interpreter #5 Failed