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.54 130,292 836 7.76 78% 67% 64% 98%
1.0 C++ g++ #9 2.62 130,212 809 7.92 76% 67% 63% 99%
1.7 Rust #2 4.31 164,868 721 15.85 90% 90% 100% 90%
1.7 C++ g++ #3 4.43 221,792 945 10.63 67% 45% 89% 42%
1.8 C++ g++ #6 4.50 221,936 844 10.93 49% 83% 45% 69%
2.0 C++ g++ #8 5.20 221,920 820 13.13 51% 79% 55% 69%
2.5 Fortran Intel #2 6.44 113,180 1148 18.96 91% 63% 65% 78%
2.8 Rust 7.11 133,500 751 24.15 94% 78% 90% 79%
3.1 C# .NET Core #4 7.83 879,216 810 25.75 81% 79% 86% 86%
3.1 Erlang HiPE #2 7.92 443,688 478 23.27 75% 76% 67% 77%
3.2 F# .NET Core #6 8.23 1,050,104 611 28.72 88% 89% 89% 85%
3.3 F# .NET Core #8 8.27 1,211,876 619 28.56 91% 83% 84% 88%
3.3 Java  #7 8.29 930,040 835 28.13 78% 94% 85% 86%
3.3 Ada 2012 GNAT #4 8.39 202,512 2107 27.21 79% 90% 75% 82%
3.3 Lisp SBCL #3 8.49 369,508 943 21.44 62% 62% 77% 58%
3.4 Ada 2012 GNAT #5 8.56 202,536 2107 27.55 72% 80% 80% 91%
3.4 C++ g++ 8.57 1,904,208 754 31.72 94% 92% 92% 94%
3.9 OCaml #2 9.81 116,084 751 29.45 88% 89% 43% 81%
4.5 Hack #4 11.40 395,744 745 36.91 73% 80% 86% 86%
4.8 Java #4 12.21 785,124 840 16.76 90% 15% 15% 18%
4.9 Java #3 12.37 827,536 540 15.89 13% 45% 62% 10%
4.9 Java #2 12.38 820,496 552 15.85 95% 10% 14% 11%
5.1 Java #6 12.97 823,964 529 16.43 11% 59% 42% 17%
5.4 Chapel 13.82 298,472 484 42.09 100% 75% 76% 56%
5.6 C# .NET Core #3 14.27 1,852,196 676 48.16 92% 81% 84% 83%
6.3 F# .NET Core #7 16.06 1,433,576 516 47.42 81% 71% 75% 71%
6.3 C gcc #5 16.09 351,440 908 56.35 78% 97% 84% 93%
7.1 C# .NET Core #2 18.13 820,684 586 19.70 30% 27% 30% 25%
8.3 Java AOT #2 21.09 655,536 552 21.07 0% 100% 2% 0%
8.3 Java AOT #3 21.15 662,220 540 21.13 1% 100% 1% 0%
8.3 Java AOT #6 21.17 654,888 529 21.15 0% 34% 67% 0%
8.7 Java AOT #7 21.99 795,064 835 43.16 50% 54% 58% 61%
8.8 OCaml #5 22.26 152,048 461 22.24 1% 0% 100% 0%
8.8 TypeScript #4 22.37 1,065,040 947 76.00 85% 85% 83% 88%
9.0 Ada 2012 GNAT #3 22.93 528,136 1266 74.73 80% 80% 79% 87%
9.1 F# .NET Core #3 23.00 821,920 531 25.32 17% 40% 40% 15%
9.1 Erlang HiPE 23.09 621,148 420 23.37 45% 1% 50% 7%
9.4 Node js #2 23.78 360,508 431 39.61 32% 46% 60% 30%
9.9 Haskell GHC 25.13 711,956 494 52.23 91% 37% 36% 45%
11 Haskell GHC #2 27.53 453,912 491 55.83 96% 35% 35% 38%
11 C# .NET Core 28.26 1,165,988 600 32.50 23% 35% 35% 24%
11 F# .NET Core 28.29 1,152,432 506 32.17 39% 35% 27% 13%
11 Racket #3 28.31 493,956 473 28.29 0% 0% 0% 100%
11 C++ g++ #2 28.57 265,072 508 28.55 1% 100% 1% 0%
11 Go #4 28.80 434,632 654 109.58 94% 95% 95% 97%
12 Racket #2 29.81 501,312 416 29.78 0% 1% 100% 0%
12 Go #2 30.23 414,780 660 115.73 97% 95% 96% 96%
12 Hack #3 31.03 395,660 425 30.94 1% 0% 100% 1%
12 VW Smalltalk #3 31.24 375,560 959 54.74 83% 56% 86% 34%
12 F# .NET Core #4 31.65 1,060,644 488 35.60 33% 37% 31% 14%
13 C gcc 31.96 263,676 654 31.94 1% 1% 100% 0%
13 Go #5 32.10 407,804 950 127.22 99% 99% 99% 99%
13 Java AOT #4 33.85 1,248,064 840 33.80 24% 0% 59% 18%
13 Ada 2012 GNAT 34.09 265,520 888 34.06 1% 71% 30% 1%
14 Go #3 35.71 874,404 640 137.77 99% 96% 97% 95%
14 Free Pascal 36.42 262,180 715 36.40 100% 1% 1% 0%
15 F# .NET Core #2 38.09 914,740 482 41.98 17% 44% 40% 11%
15 Dart 38.26 546,636 457 49.77 26% 28% 58% 20%
18 Node js 45.23 664,688 440 97.71 48% 49% 58% 62%
18 TypeScript 45.79 653,260 451 97.27 72% 46% 48% 48%
18 TypeScript #2 45.97 664,376 448 97.18 51% 70% 46% 45%
19 Racket 49.22 619,480 476 49.17 0% 35% 66% 0%
21 Ruby #5 52.83 433,920 1107 177.53 79% 94% 87% 78%
22 Go 55.80 265,700 482 97.60 43% 46% 46% 41%
22 Go #9 56.29 257,972 508 97.47 41% 48% 41% 45%
23 Go #7 58.12 256,892 525 101.85 46% 42% 45% 43%
24 JRuby #5 61.89 2,333,436 1083 230.83 95% 93% 94% 92%
26 PHP #6 65.20 736,468 868 235.57 93% 94% 92% 98%
30 VW Smalltalk 76.77 375,384 744 76.69 0% 0% 0% 100%
31 PHP #5 79.01 736,908 1040 222.04 91% 95% 0% 95%
33 PHP #7 85.02 1,551,888 751 197.60 87% 71% 77% 81%
37 Python 3 93.40 449,328 589 5 min 88% 92% 94% 89%
37 Ruby #4 94.46 438,156 364 134.28 15% 30% 22% 77%
40 Fortran Intel 101.20 791,484 773 101.13 98% 2% 1% 0%
40 JRuby #4 102.47 1,650,420 364 184.09 48% 55% 46% 32%
41 JRuby #3 104.97 1,820,664 400 121.45 20% 36% 29% 33%
44 Truffle Ruby #5 112.25 2,304,072 1107 6 min 92% 92% 92% 95%
44 PHP #4 112.74 1,552,072 770 5 min 67% 89% 70% 71%
45 Truffle Ruby #4 113.72 2,319,404 364 225.50 35% 43% 78% 43%
45 Truffle Ruby #3 114.96 2,186,464 400 221.37 50% 43% 37% 64%
45 JRuby 115.20 2,325,012 376 236.18 66% 37% 55% 53%
46 JRuby #2 115.96 2,325,612 378 238.94 52% 62% 52% 42%
46 Ruby 117.97 440,916 376 157.63 45% 56% 24% 10%
47 Truffle Ruby #2 119.46 2,207,032 378 232.21 46% 41% 50% 61%
47 Truffle Ruby 119.55 2,294,560 376 234.84 41% 68% 35% 54%
48 Ruby #2 121.26 440,796 378 160.95 27% 8% 91% 9%
49 Ruby #3 124.41 526,356 400 164.03 47% 56% 26% 8%
54 Hack #2 136.73 658,924 422 136.58 2% 1% 100% 1%
58 Hack 146.79 658,532 451 146.64 1% 99% 1% 0%
72 Perl #3 183.13 2,199,432 648 10 min 83% 93% 77% 81%
88 PHP #3 223.82 1,551,796 428 223.65 5% 13% 19% 66%
90 PHP 228.50 734,884 451 228.33 29% 0% 0% 72%
119 Python 3 #2 5 min 274,460 338 5 min 1% 1% 1% 100%
127 PHP #2 5 min 734,856 423 5 min 0% 77% 23% 1%
170 Perl 7 min 598,628 395 7 min 9% 1% 1% 91%
184 Lua #2 7 min 2,312,236 412 7 min 59% 1% 1% 42%
500 Matz's Ruby #3 21 min 839,728 400 21 min 25% 0% 0% 76%
689 Matz's Ruby #4 29 min 1,558,692 364 29 min 18% 2% 10% 71%
725 Matz's Ruby #2 30 min 1,558,396 378 30 min 35% 17% 1% 49%
725 Matz's Ruby 30 min 1,558,300 376 30 min 80% 21% 1% 1%
F# .NET Core #5 Bad Output
Haskell GHC #6 Make Error
Haskell GHC #5 Make Error
Haskell GHC #3 Make Error
Haskell GHC #4 Bad Output
Lisp SBCL #2 Timed Out
Lisp SBCL Timed Out
Matz's Ruby #5 Failed
Swift Failed
Swift #9 Failed