The Computer Language
24.11 Benchmarks Game

binary-trees

First, here are a few naive un-optimised single-thread #8 programs transliterated lowest-common-denominator style into different programming languages from the same original —

  source secs mem gz    
  C clang #8 19.63 285,536 607    
  C gcc #8 21.08 285,544 607    
  Intel C #8 19.46 285,952 607    
  Swift #8 54.90 402,048 567    
  Dart #8 14.10 432,452 536    
  Ruby yjit #8 130.97 478,720 494    
  PHP #8 92.50 750,592 590    
  Python 3 #8 9 min 798,336 535    
  C# .NET #8 13.50 883,524 601    
  Java -Xint #8 94.28 1,163,864 596    
  Node.js #8 19.86 1,334,104 521    
  Java #8 6.57 1,767,108 596    
 
 
  Here are the crowd sourced programs —  
 
 
× source secs mem gz cpu secs cpu load
1.0 Free Pascal #6 2.10 132,608 967 5.03 100% 54% 39% 47%
1.0 Free Pascal #7 2.15 132,608 1010 5.15 99% 41% 45% 54%
1.0 Free Pascal #5 2.10 132,608 959 5.00 54% 100% 47% 39%
1.0 Rust 2.05 132,992 760 7.21 83% 96% 86% 87%
1.0 C gcc #3 1.96 134,540 842 4.70 53% 43% 100% 44%
1.0 C++ g++ #9 1.74 136,120 815 4.63 63% 54% 100% 50%
1.1 Intel Fortran #2 2.22 140,544 1155 6.86 85% 67% 68% 90%
1.3 C gcc #2 1.53 169,284 816 4.18 99% 66% 57% 52%
1.4 Rust #4 1.33 187,948 765 4.80 88% 88% 99% 88%
1.4 Rust #3 1.40 188,740 762 5.06 89% 87% 99% 87%
1.5 Rust #5 1.08 198,656 771 3.77 84% 99% 83% 85%
1.5 Rust #2 1.22 199,684 729 4.29 85% 86% 85% 98%
1.5 C++ g++ #5 1.16 200,724 891 4.10 86% 98% 87% 86%
1.5 C++ g++ #7 0.97 201,512 896 3.40 84% 99% 84% 84%
1.6 OCaml #2 3.59 216,628 759 10.35 43% 76% 84% 85%
1.7 OCaml #5 7.80 221,952 468 7.80 0% 0% 1% 100%
1.8 Haskell GHC #6 4.06 236,896 601 7.72 44% 42% 56% 49%
1.8 Go 32.01 243,192 488 59.78 45% 50% 46% 44%
1.9 Go #7 32.52 248,604 531 61.47 45% 50% 51% 43%
2.0 Haskell GHC #7 2.39 262,800 817 6.02 61% 70% 65% 56%
2.0 C gcc 21.67 264,244 660 21.67 47% 18% 0% 34%
2.0 Haskell GHC #2 12.13 264,704 498 13.80 31% 60% 17% 6%
2.0 C++ g++ #3 1.91 265,636 951 4.74 76% 41% 86% 45%
2.0 C++ g++ #2 22.83 265,840 514 22.82 70% 0% 0% 30%
2.0 C++ g++ #6 1.91 266,120 851 4.77 47% 87% 53% 63%
2.0 C++ g++ #4 2.22 266,136 826 5.20 33% 61% 52% 87%
2.0 Ada 2012 GNAT 23.45 266,316 896 23.45 43% 23% 0% 33%
2.0 Haskell GHC #4 2.06 271,032 807 5.24 63% 60% 58% 72%
2.1 Python 3 #2 100.90 271,872 344 100.89 98% 0% 0% 1%
2.1 Python 3 #5 35.49 274,816 669 126.17 95% 89% 88% 82%
2.1 Python 3 #4 33.61 276,992 481 121.96 93% 88% 89% 93%
2.1 Python 3 36.12 276,992 597 127.68 87% 95% 86% 85%
2.2 C gcc #8 21.08 285,544 607 21.08 62% 0% 38% 0%
2.3 Chapel #3 8.47 300,672 494 25.56 99% 74% 56% 72%
2.5 Go #3 14.91 326,508 806 58.00 98% 96% 98% 96%
2.5 Racket #2 9.11 327,096 422 9.11 0% 100% 0% 0%
2.6 C gcc #5 8.77 351,332 914 31.93 92% 91% 88% 91%
2.8 VW Smalltalk 37.93 375,552 717 37.93 2% 97% 0% 0%
2.8 VW Smalltalk #3 16.93 375,808 932 38.02 50% 62% 82% 30%
3.0 Swift #8 54.90 402,048 567 54.89 0% 100% 0% 0%
3.0 Go #6 27.90 404,096 618 29.26 74% 4% 23% 2%
3.2 Go #5 14.87 425,960 957 58.15 98% 98% 97% 98%
3.3 Dart #8 14.10 432,452 536 18.56 58% 16% 11% 45%
3.3 Julia #2 11.38 441,140 430 12.44 1% 98% 0% 9%
3.3 Julia #4 10.32 443,600 378 11.22 5% 99% 3% 1%
3.4 Dart #6 11.70 445,528 488 15.84 46% 21% 15% 53%
3.6 Dart #5 12.60 474,784 1023 28.93 55% 56% 61% 58%
3.6 Chapel #4 7.11 477,824 489 26.09 99% 89% 89% 90%
3.6 Ruby yjit #4 47.23 478,464 371 47.22 97% 0% 2% 0%
3.6 Ruby yjit 48.86 478,592 383 48.85 100% 0% 0% 0%
3.6 Ruby yjit #8 130.97 478,720 494 130.95 3% 96% 0% 0%
3.6 Erlang #2 4.81 478,992 485 13.06 90% 62% 71% 74%
3.6 Julia #5 17.97 482,024 396 57.53 74% 84% 85% 77%
3.6 Erlang 10.90 482,520 426 11.11 7% 61% 33% 1%
3.7 Julia #3 7.08 486,976 640 19.44 78% 73% 57% 67%
3.9 Ruby yjit #3 49.82 517,080 407 49.81 100% 0% 0% 0%
3.9 Ruby yjit #5 19.08 521,972 1016 54.19 98% 61% 61% 64%
4.0 Ruby yjit #2 48.90 524,800 385 48.89 43% 0% 56% 0%
4.0 Intel Fortran 32.59 525,824 780 32.59 100% 0% 0% 0%
4.0 Ada 2012 GNAT #3 11.30 529,436 1275 37.09 80% 81% 87% 80%
4.1 Racket 15.10 543,632 482 15.09 0% 99% 0% 0%
4.2 Dart #4 11.56 562,668 1394 24.55 59% 46% 52% 55%
4.5 Perl 263.97 599,424 401 263.95 0% 96% 3% 0%
4.7 Go #2 14.17 624,780 672 56.29 99% 99% 99% 99%
4.9 Lisp SBCL 9.57 643,680 595 9.57 0% 100% 0% 0%
5.0 Lisp SBCL #3 3.00 660,620 938 7.41 58% 84% 61% 45%
5.1 Haskell GHC #5 7.37 671,276 567 15.63 48% 53% 70% 40%
5.1 Haskell GHC 12.68 671,616 500 14.44 9% 13% 77% 14%
5.1 Python 3 #3 52.28 671,872 1247 149.07 89% 64% 59% 71%
5.1 Dart #7 10.93 674,712 869 24.84 60% 58% 50% 59%
5.1 Haskell GHC #3 6.96 682,624 544 15.87 55% 64% 51% 57%
5.3 Swift #2 18.29 707,456 822 58.16 99% 63% 79% 76%
5.3 Swift #4 17.49 707,456 772 55.84 65% 99% 75% 79%
5.3 Swift #3 18.18 707,584 868 58.24 99% 64% 79% 77%
5.6 Swift 18.28 737,152 720 54.20 94% 61% 68% 72%
5.6 Swift #5 18.89 738,048 813 56.25 74% 60% 94% 70%
5.6 PHP 61.97 748,788 457 61.97 13% 86% 0% 0%
5.6 PHP #2 63.25 748,792 429 63.24 0% 100% 0% 0%
5.7 PHP #8 92.50 750,592 590 92.49 0% 100% 0% 0%
5.7 Perl #6 40.21 760,192 800 148.50 90% 90% 99% 90%
6.0 Python 3 #8 9 min 798,336 535 9 min 8% 91% 0% 0%
6.1 PHP #5 33.17 805,512 1048 84.83 24% 77% 86% 68%
6.1 PHP #6 27.48 805,532 877 91.38 79% 89% 87% 77%
6.1 Lua #3 83.71 809,856 690 167.26 59% 47% 40% 52%
6.3 Matz's Ruby #3 9 min 840,268 407 9 min 100% 0% 0% 0%
6.7 C# .NET #8 13.50 883,524 601 15.31 8% 31% 41% 33%
6.9 PHP #4 18.34 918,528 786 56.94 73% 82% 70% 85%
6.9 PHP #3 46.07 921,600 434 46.07 3% 96% 0% 0%
7.2 PHP #7 15.58 948,608 767 56.00 88% 89% 93% 89%
7.2 Lua #4 48.65 956,672 670 180.27 97% 91% 91% 91%
7.2 Lua #2 141.55 956,672 418 141.52 100% 0% 0% 0%
7.5 F# .NET #7 7.58 988,852 527 21.64 72% 72% 70% 72%
7.8 F# .NET 11.60 1,036,652 517 13.72 15% 61% 27% 19%
7.9 Perl #5 52.18 1,048,704 805 189.88 87% 100% 88% 88%
8.1 Node.js #7 16.02 1,070,260 458 28.26 41% 39% 61% 34%
8.1 C# .NET #7 5.34 1,074,228 706 17.42 81% 78% 81% 87%
8.2 C# .NET #2 5.37 1,083,480 717 17.60 83% 79% 89% 77%
9.4 Node.js #6 8.60 1,250,816 752 30.68 90% 88% 87% 91%
10 Node.js #8 19.86 1,334,104 521 32.74 45% 32% 54% 33%
11 Node.js 8.92 1,405,276 717 33.60 95% 94% 93% 94%
12 Matz's Ruby 13 min 1,558,912 383 13 min 25% 0% 0% 74%
12 Matz's Ruby #2 13 min 1,559,040 385 13 min 94% 1% 0% 4%
12 Matz's Ruby #4 12 min 1,559,040 371 12 min 96% 3% 0% 0%
12 Matz's Ruby #5 5 min 1,559,164 1016 17 min 74% 73% 96% 72%
13 Java  #8 6.57 1,767,108 596 7.29 7% 17% 28% 60%
13 Java #3 4.85 1,769,500 546 5.65 8% 75% 5% 27%
13 Chapel #5 2.04 1,775,616 646 7.28 95% 86% 86% 92%
13 Java #6 4.87 1,782,568 535 5.63 13% 39% 54% 9%
14 Java #7 2.62 1,803,192 841 8.14 84% 74% 75% 78%
14 Java #2 5.09 1,820,068 558 5.83 8% 19% 8% 78%
14 Java #4 4.41 1,821,244 846 5.14 11% 6% 52% 46%
16 C++ g++ 2.65 2,153,044 760 9.23 85% 95% 85% 86%
17 Perl #3 110.37 2,200,700 655 6 min 74% 93% 73% 98%
19 Perl #4 79.54 2,519,560 769 287.74 88% 95% 88% 89%
22 C# .NET #3 6.45 2,900,008 688 20.33 82% 76% 80% 77%
24 C# .NET 6.11 3,178,448 668 19.93 85% 77% 79% 91%
41 Dart #3 21.25 5,400,800 1219 53.12 61% 63% 59% 68%
Ada 2012 GNAT #4 Failed
C# .NET #6 Make Error
Matz's Ruby #8 Timed Out
Swift #9 Make Error
 
 
  * possible hand-written vector instructions | "unsafe"
 
× source secs mem gz cpu secs cpu load
1.7 * Racket #3 6.14 223,504 480 6.14 0% 0% 100% 0%
3.2 * Racket #4 5.00 418,536 861 9.56 56% 43% 51% 42%