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.4 C++ g++ #3 4.23 265,132 945 10.75 71% 53% 54% 80%
1.6 C++ g++ #6 4.17 265,420 844 12.32 90% 75% 100% 36%
1.8 C++ g++ #8 4.73 265,496 820 13.62 41% 100% 67% 84%
1.8 Swift #9 4.88 192,428 997 13.77 91% 61% 69% 63%
2.1 Rust #2 4.27 184,600 714 15.84 98% 92% 92% 92%
2.1 Fortran Intel #2 5.50 119,140 1148 16.35 64% 64% 100% 71%
2.5 C# .NET Core #2 17.09 833,424 586 19.13 33% 34% 7% 39%
2.7 Erlang HiPE 21.05 483,332 420 21.05 1% 1% 1% 99%
3.0 OCaml #5 22.87 151,724 456 22.84 1% 0% 0% 100%
3.0 Ada 2005 GNAT #4 7.72 202,276 2101 23.33 70% 79% 90% 68%
3.1 Ada 2005 GNAT #5 7.75 202,308 2101 23.62 69% 96% 78% 66%
3.2 C# .NET Core #4 7.40 684,584 780 24.34 86% 83% 81% 83%
3.2 Rust 7.10 148,180 746 24.90 92% 89% 89% 83%
3.4 Java  #3 14.94 521,004 540 26.03 26% 31% 57% 63%
3.4 Lisp SBCL 26.56 538,328 594 26.51 1% 100% 1% 0%
3.5 Racket #3 26.58 493,088 473 26.53 1% 0% 100% 1%
3.5 Java #6 15.13 520,676 529 26.95 69% 56% 28% 28%
3.5 F# .NET Core #3 23.71 596,776 531 27.26 36% 20% 36% 27%
3.6 Erlang HiPE #2 8.05 571,444 478 27.34 96% 81% 81% 84%
3.7 Racket #2 28.12 493,048 416 28.06 100% 0% 1% 0%
3.8 Java #2 15.73 542,932 552 29.06 35% 36% 66% 52%
3.9 OCaml #2 9.95 115,760 746 29.67 99% 73% 41% 87%
4.1 Hack #3 31.25 507,332 425 31.21 1% 1% 100% 0%
4.4 C++ g++ 8.87 1,824,860 754 33.68 95% 95% 95% 99%
4.5 Java #4 17.09 714,012 840 34.22 46% 36% 73% 49%
4.6 F# .NET Core 29.64 582,588 506 35.40 30% 19% 39% 34%
4.6 C gcc 35.57 263,492 654 35.54 1% 1% 100% 0%
4.7 Pascal Free Pascal 36.18 262,180 705 36.15 1% 0% 1% 100%
4.7 Hack #4 10.87 508,460 736 36.47 87% 98% 74% 79%
4.9 C++ g++ #2 37.33 264,900 508 37.30 0% 100% 1% 0%
4.9 C# .NET Core 30.22 1,605,128 600 38.02 37% 27% 25% 39%
5.0 F# .NET Core #4 32.67 662,164 488 38.66 24% 22% 27% 48%
5.1 Java #7 11.26 593,156 835 39.02 85% 88% 90% 88%
5.3 Ada 2005 GNAT 40.62 265,408 881 40.59 1% 1% 0% 100%
5.7 Chapel 14.32 324,660 484 44.15 100% 58% 78% 75%
5.9 F# .NET Core #2 39.79 684,416 475 45.43 31% 30% 27% 28%
6.0 Erlang 45.95 521,296 420 45.94 100% 1% 1% 0%
6.0 Racket 46.50 620,368 476 46.43 1% 0% 1% 100%
6.8 Node.js 51.21 931,768 440 51.98 57% 10% 30% 5%
6.8 TypeScript #2 51.88 933,276 448 52.64 48% 17% 14% 26%
6.9 Haskell GHC 26.28 511,444 494 52.69 35% 41% 93% 34%
6.9 TypeScript 52.10 933,224 451 52.84 42% 17% 32% 13%
7.0 Erlang #2 15.51 511,840 478 53.73 88% 83% 91% 86%
7.2 C# .NET Core #3 17.62 2,674,764 676 55.41 85% 76% 78% 78%
7.3 Dart 41.89 484,776 457 55.98 25% 61% 32% 17%
8.0 Fortran Intel 61.39 263,844 773 61.34 100% 0% 0% 1%
9.9 Smalltalk VW 75.98 374,740 658 75.87 10% 53% 39% 1%
10 C gcc #5 20.52 353,080 908 77.16 96% 95% 94% 92%
13 Ada 2005 GNAT #3 26.40 527,976 1263 96.45 91% 90% 90% 96%
13 Go #9 63.49 288,524 508 103.46 43% 38% 46% 38%
14 Go 65.70 283,056 482 105.81 43% 39% 43% 38%
14 Go #7 66.59 279,408 525 108.84 42% 42% 47% 34%
16 Ruby JRuby #3 95.75 1,319,804 400 125.48 26% 72% 24% 30%
17 Go #4 34.77 269,068 654 132.04 95% 97% 95% 95%
17 Hack #2 132.52 1,162,428 422 132.41 2% 1% 0% 100%
17 Go #2 35.07 275,868 660 133.58 95% 96% 97% 95%
18 Swift 45.55 739,152 714 135.25 90% 72% 69% 68%
18 Go #5 35.86 272,704 950 140.11 98% 98% 98% 98%
18 Ruby JRuby #4 96.80 1,725,928 364 142.04 20% 80% 31% 19%
19 Ruby #4 144.64 562,464 364 144.49 1% 22% 78% 2%
19 Hack 145.46 1,160,496 451 145.33 100% 1% 1% 0%
20 Ruby #5 54.24 510,868 1078 153.99 73% 98% 67% 72%
21 Ruby JRuby #2 104.13 1,772,576 378 159.13 23% 54% 52% 26%
21 Ruby JRuby 103.56 1,790,696 376 162.56 23% 37% 76% 23%
23 Ruby #2 179.00 563,084 378 178.84 1% 100% 0% 2%
23 Ruby 180.01 563,124 376 179.85 67% 1% 34% 1%
24 Ruby #3 186.48 434,456 400 186.32 2% 0% 100% 1%
30 Ruby JRuby #5 62.06 1,693,060 1078 230.50 92% 93% 95% 94%
31 PHP #3 241.44 1,551,556 428 241.24 100% 0% 1% 0%
32 PHP #5 88.07 736,372 1027 247.49 92% 77% 23% 91%
34 PHP 263.74 734,416 451 263.49 3% 100% 2% 3%
35 Python 3 #2 265.47 274,404 338 265.33 1% 0% 100% 1%
40 Python 3 86.90 451,548 581 5 min 89% 97% 87% 89%
43 PHP #4 275.97 1,551,680 762 5 min 93% 92% 88% 92%
47 PHP #2 6 min 734,364 423 6 min 100% 2% 3% 2%
47 Lua #2 6 min 2,194,388 412 6 min 38% 28% 36% 1%
59 Perl 7 min 598,556 395 7 min 19% 13% 48% 21%
84 Perl #3 197.93 2,133,108 641 10 min 68% 71% 92% 96%
F# .NET Core #5 Bad Output
Haskell GHC #4 Bad Output
Lisp SBCL #2 Bad Output