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%
1.9 Rust #2 4.43 196,468 717 16.56 92% 92% 100% 93%
2.0 C++ g++ #8 4.73 265,496 820 13.62 41% 100% 67% 84%
2.1 Swift #9 4.97 194,028 997 13.96 60% 63% 100% 60%
2.3 Fortran Intel #2 5.50 119,140 1148 16.35 64% 64% 100% 71%
2.7 Rust 6.39 148,332 746 22.38 78% 91% 86% 99%
3.0 C# .NET Core #5 7.15 740,308 851 23.70 85% 83% 82% 85%
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.77 762,720 780 25.04 82% 82% 83% 79%
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.95 115,760 746 29.67 99% 73% 41% 87%
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.5 C# .NET Core #3 15.43 2,036,016 676 48.97 83% 77% 81% 80%
6.6 Erlang #2 15.51 511,840 478 53.73 88% 83% 91% 86%
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.9 C# .NET Core #2 18.75 835,596 586 20.49 39% 22% 17% 34%
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.7 OCaml #5 22.87 151,724 456 22.84 1% 0% 0% 100%
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.58 493,088 473 26.53 1% 0% 100% 1%
11 Haskell GHC 26.91 511,620 494 54.58 36% 56% 39% 74%
12 Racket #2 28.12 493,048 416 28.06 100% 0% 1% 0%
12 C# .NET Core 28.83 1,154,248 600 33.06 27% 31% 47% 13%
13 Smalltalk VW #3 31.15 375,020 938 83.72 59% 78% 64% 71%
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%
17 Ada 2005 GNAT 40.62 265,408 881 40.59 1% 1% 0% 100%
18 Dart 41.89 484,776 457 55.98 25% 61% 32% 17%
19 Swift 45.37 737,044 714 133.49 68% 59% 96% 73%
19 Erlang 45.95 521,296 420 45.94 100% 1% 1% 0%
20 Racket 46.50 620,368 476 46.43 1% 0% 1% 100%
22 Node.js 51.21 931,768 440 51.98 57% 10% 30% 5%
22 TypeScript #2 51.88 933,276 448 52.64 48% 17% 14% 26%
22 TypeScript 52.10 933,224 451 52.84 42% 17% 32% 13%
23 Ruby #5 54.24 510,868 1078 153.99 73% 98% 67% 72%
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%
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 Failed
F# .NET Core #4 Failed
F# .NET Core #3 Failed
F# .NET Core #2 Failed
F# .NET Core #5 Failed
Haskell GHC #4 Bad Output
Lisp SBCL #2 Bad Output