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 3.68 119,052 809 11.93 98% 76% 77% 78%
1.0 C gcc #3 3.73 116,600 836 11.74 76% 71% 98% 72%
1.1 Rust #2 4.11 175,320 721 15.08 100% 90% 90% 90%
1.4 Swift #9 5.12 190,820 1001 14.38 63% 60% 60% 100%
1.5 C++ g++ #6 5.64 221,680 844 15.38 73% 71% 85% 48%
1.5 C++ g++ #3 5.65 221,580 945 16.40 79% 40% 90% 84%
1.7 C++ g++ #8 6.29 221,736 820 16.62 62% 96% 60% 50%
1.9 Rust 6.86 133,512 751 23.53 80% 78% 90% 99%
2.1 C# .NET Core #4 7.73 809,848 810 25.41 82% 89% 83% 79%
2.1 F# .NET Core #6 7.80 1,128,860 611 27.62 93% 91% 86% 87%
2.2 F# .NET Core #8 7.98 1,041,668 619 27.92 89% 87% 89% 86%
2.2 Erlang HiPE #2 8.10 445,948 478 23.68 86% 69% 73% 67%
2.3 Java  #7 8.39 960,056 835 27.39 81% 85% 74% 90%
2.4 C++ g++ 8.83 1,961,392 754 32.64 92% 92% 97% 91%
2.5 Ada 2012 GNAT #4 9.26 202,320 2107 32.16 87% 87% 94% 82%
2.6 Ada 2012 GNAT #5 9.40 202,252 2107 32.42 98% 83% 84% 83%
2.6 OCaml #2 9.65 116,140 751 28.69 89% 43% 98% 69%
3.1 Java #4 11.23 777,936 840 13.71 81% 10% 9% 24%
3.1 Lisp SBCL #3 11.45 288,612 943 24.01 42% 51% 65% 55%
3.2 Java #3 11.67 732,632 540 14.04 8% 23% 80% 11%
3.2 Java #6 11.78 734,420 529 14.16 41% 8% 11% 64%
3.2 Java #2 11.95 781,108 552 14.31 36% 11% 6% 69%
3.6 Haskell GHC #6 13.25 474,224 592 48.76 90% 93% 91% 97%
4.0 C# .NET Core #3 14.67 2,155,576 676 47.99 85% 81% 79% 85%
4.1 Chapel #2 15.11 361,728 470 47.90 100% 55% 73% 91%
4.2 Fortran Intel #2 15.35 101,984 1148 15.34 0% 0% 1% 100%
4.4 F# .NET Core #7 16.28 1,280,416 516 48.30 75% 79% 77% 69%
4.7 Haskell GHC #3 17.14 701,284 538 64.24 97% 94% 96% 90%
4.7 C# .NET Core #2 17.35 819,388 586 18.98 35% 36% 29% 12%
4.7 Haskell GHC #5 17.39 696,452 561 64.54 95% 91% 92% 95%
4.9 C gcc #5 17.90 351,384 908 64.58 98% 93% 81% 90%
5.9 Substrate VM #2 21.56 657,424 552 21.52 14% 1% 1% 86%
5.9 OCaml #5 21.64 152,064 461 21.61 100% 1% 1% 0%
5.9 Substrate VM #3 21.66 658,244 540 21.62 100% 1% 0% 0%
5.9 Substrate VM #6 21.71 658,308 529 21.68 100% 0% 1% 0%
6.2 TypeScript #4 22.71 1,047,928 947 74.98 83% 86% 83% 80%
6.2 F# .NET Core #3 22.84 823,688 531 25.20 46% 14% 24% 29%
6.3 Erlang HiPE 23.19 606,612 420 23.45 38% 45% 1% 18%
6.5 Node js #2 23.78 346,456 431 39.43 46% 35% 28% 58%
6.5 Substrate VM #7 23.92 812,588 835 46.01 52% 41% 33% 68%
7.0 Ada 2012 GNAT #3 25.59 528,092 1266 83.15 79% 81% 86% 80%
7.2 Haskell GHC #2 26.45 454,852 491 53.60 45% 53% 67% 40%
7.2 Haskell GHC 26.50 666,824 494 50.53 52% 32% 33% 76%
7.5 Racket #3 27.62 505,620 473 27.59 0% 100% 1% 0%
7.5 Dart 27.64 901,156 457 31.09 51% 18% 9% 38%
7.5 Dart app-jit 27.67 820,824 457 31.10 10% 87% 10% 7%
7.7 Racket #2 28.21 521,988 416 28.17 1% 0% 0% 100%
7.7 F# .NET Core 28.25 1,189,176 506 32.13 29% 28% 28% 30%
7.8 Go #4 28.82 463,464 654 109.73 97% 95% 95% 94%
7.8 C# .NET Core 28.83 1,209,232 600 33.02 48% 24% 20% 24%
7.9 Lisp SBCL 28.92 374,496 589 28.88 0% 0% 100% 1%
8.2 Go #2 30.02 408,444 660 114.95 95% 96% 96% 96%
8.5 Go #5 31.13 374,912 950 123.38 99% 100% 99% 100%
8.5 F# .NET Core #4 31.36 942,872 488 34.94 25% 33% 38% 18%
8.6 VW Smalltalk #3 31.64 375,484 959 79.76 68% 43% 83% 59%
9.5 Substrate VM #4 35.08 1,246,304 840 35.02 0% 100% 0% 1%
10 Free Pascal 36.76 262,180 715 36.73 0% 1% 1% 100%
10 C++ g++ #2 37.31 265,008 508 37.29 100% 1% 1% 0%
10 Go #3 37.54 1,006,932 640 143.59 95% 95% 97% 97%
10 F# .NET Core #2 38.21 1,005,304 482 41.81 27% 38% 32% 14%
10 Ruby #5 38.36 468,512 1107 115.36 73% 70% 94% 66%
11 C gcc 39.77 263,760 654 39.74 0% 1% 100% 0%
12 Ada 2012 GNAT 42.97 265,300 888 42.94 0% 1% 1% 100%
12 Swift 44.71 738,064 714 131.81 65% 91% 67% 73%
13 Racket 47.07 623,588 476 47.01 72% 1% 1% 29%
13 TypeScript #2 47.65 598,692 448 96.04 68% 42% 42% 52%
13 TypeScript 47.82 604,596 451 97.31 48% 45% 44% 67%
13 Node js 48.81 622,768 440 98.77 48% 64% 43% 49%
16 Go 57.36 359,840 482 97.82 45% 43% 44% 40%
16 Go #9 57.42 290,780 508 98.51 41% 50% 38% 44%
16 Go #7 58.15 249,816 525 101.00 42% 43% 46% 44%
16 PHP #6 58.93 765,500 868 214.32 90% 98% 92% 90%
17 JRuby #5 60.98 2,336,824 1083 224.55 92% 92% 95% 91%
17 Fortran Intel 62.33 525,624 773 62.29 0% 1% 100% 0%
19 PHP #7 68.14 1,584,520 751 199.93 79% 75% 73% 86%
20 PHP #5 73.54 779,912 1040 208.30 75% 96% 33% 88%
21 VW Smalltalk 77.16 375,220 744 77.08 0% 1% 1% 100%
23 Python 3 83.95 451,732 589 290.57 88% 87% 87% 97%
25 JRuby #3 91.89 1,727,172 400 106.86 32% 26% 33% 26%
26 Julia 96.71 710,224 436 96.91 0% 0% 0% 100%
27 Ruby #4 98.15 469,008 364 139.96 34% 60% 21% 42%
27 JRuby #4 99.99 1,677,372 364 183.52 68% 35% 46% 37%
28 Truffle Ruby #4 104.00 2,294,396 364 187.65 58% 41% 37% 47%
29 Truffle Ruby #5 105.75 2,249,960 1107 6 min 93% 96% 91% 92%
29 JRuby #2 106.82 2,325,992 378 210.00 56% 48% 44% 50%
29 PHP #4 107.82 1,554,040 770 213.85 82% 81% 76% 84%
30 Truffle Ruby #3 111.97 2,194,844 400 214.96 49% 55% 51% 37%
31 Truffle Ruby #2 112.69 2,234,956 378 215.50 44% 40% 44% 65%
31 JRuby 113.28 2,331,656 376 226.11 41% 50% 59% 50%
31 Truffle Ruby 114.78 2,219,400 376 224.24 53% 48% 51% 45%
36 Ruby 133.19 469,524 376 174.93 96% 16% 14% 7%
36 Ruby #2 133.89 469,192 378 175.53 16% 84% 18% 15%
37 Ruby #3 135.68 525,248 400 177.20 18% 17% 14% 83%
42 PHP #3 153.31 1,557,716 428 153.20 1% 100% 0% 0%
46 PHP 170.67 740,328 451 170.53 56% 23% 9% 31%
49 PHP #2 181.86 745,736 423 181.71 4% 100% 1% 3%
50 Perl #3 183.35 2,197,900 648 9 min 66% 74% 93% 92%
70 Python 3 #2 256.35 274,160 338 256.21 91% 10% 1% 9%
116 Perl 7 min 599,000 395 7 min 2% 68% 33% 1%
128 Lua #2 7 min 2,277,664 412 7 min 61% 38% 1% 4%
360 Matz's Ruby #3 22 min 840,012 400 22 min 1% 57% 44% 0%
475 Matz's Ruby #4 29 min 1,558,460 364 29 min 3% 10% 90% 4%
506 Matz's Ruby 31 min 1,558,620 376 31 min 19% 82% 3% 5%
513 Matz's Ruby #2 31 min 1,558,656 378 31 min 0% 26% 75% 0%
F# .NET Core #5 Bad Output
Haskell GHC #4 Bad Output
Lisp SBCL #2 Bad Output
Matz's Ruby #5 Failed