The Computer Language
24.04 Benchmarks Game

pidigits

Arbitrary precision arithmetic might be provided by wrapping a third-party library written in some-other programming language. How would you know?

First a few simple programs.

Then optimisations, multicore parallelism, [pdf] vector parallelism.

Last hand-written vector instructions and "unsafe" programs and the more obvious foreign function interface programs.

  source secs mem gz    
  Haskell GHC #6 1.59 19,668 368    
  Lisp SBCL #3 3.38 434,560 499    
  Racket 10.38 78,084 459    
 
 
 
× source secs mem gz cpu secs cpu load
1.0 Rust #4 0.71 19,660 804 0.71 98% 0% 2% 0%
1.1 Chapel #2 0.75 19,776 423 0.76 98% 2% 1% 0%
1.1 C gcc #2 0.81 19,520 422 0.81 0% 0% 100% 0%
1.2 C gcc 0.88 19,520 459 0.88 0% 100% 0% 3%
1.2 C++ g++ #4 0.88 19,804 521 0.88 0% 0% 100% 0%
1.4 PHP #5 1.02 19,396 405 1.02 0% 0% 100% 0%
1.5 PHP #4 1.04 19,396 396 1.04 0% 0% 100% 2%
1.5 PHP #3 1.05 19,396 510 1.04 100% 1% 2% 0%
1.7 Node js #4 1.24 50,540 487 1.26 0% 2% 99% 0%
1.9 Go 1.35 19,696 715 1.37 15% 2% 12% 72%
2.1 PHP #2 1.47 19,396 552 1.46 0% 100% 1% 0%
2.1 Matz's Ruby #5 1.50 299,640 481 1.50 0% 0% 100% 0%
2.2 Ruby #5 1.56 850,304 494 1.55 1% 100% 2% 0%
2.2 Haskell GHC #6 1.59 19,668 368 1.65 93% 2% 3% 2%
2.5 Haskell GHC #4 1.80 19,796 355 1.87 8% 7% 91% 7%
3.0 Go #2 2.13 19,824 740 2.19 2% 34% 49% 18%
3.1 Haskell GHC #3 2.17 19,796 387 2.25 3% 33% 66% 2%
3.1 Haskell GHC #2 2.19 19,796 592 2.26 3% 30% 54% 18%
3.1 Haskell GHC 2.22 19,796 466 2.29 28% 53% 2% 21%
3.5 Go #8 2.49 19,696 727 2.50 0% 99% 1% 0%
3.9 Matz's Ruby #2 2.75 118,660 654 2.75 0% 0% 100% 0%
4.0 Dart #2 2.82 19,792 496 2.86 0% 1% 0% 99%
4.0 OCaml #5 2.86 19,508 465 2.86 100% 0% 0% 1%
4.5 Dart #3 3.19 19,792 495 3.24 69% 1% 29% 0%
4.5 Ruby #2 3.22 2,271,624 666 3.22 100% 0% 1% 0%
4.6 Erlang #2 3.27 61,680 518 5.16 20% 23% 95% 19%
4.7 Lisp SBCL #4 3.37 429,312 495 3.37 1% 1% 100% 0%
4.7 Lisp SBCL #3 3.38 434,560 499 3.38 0% 0% 1% 99%
4.8 Erlang #3 3.38 56,616 568 4.45 5% 97% 23% 6%
6.6 Python 3 #4 4.73 19,656 348 4.73 0% 0% 100% 1%
7.2 Go #7 5.12 19,824 702 5.88 30% 26% 31% 26%
8.4 Erlang 6.01 74,676 565 6.75 4% 4% 7% 97%
8.4 Lisp SBCL #2 6.01 429,816 655 6.01 0% 1% 99% 0%
9.1 C# .NET #7 6.49 53,064 579 7.05 5% 36% 56% 12%
11 Java  7.61 486,236 807 8.69 29% 16% 27% 42%
12 VW Smalltalk #4 8.19 55,808 757 8.19 100% 0% 0% 1%
15 Racket 10.38 78,084 459 10.38 0% 100% 1% 0%
16 Perl 11.68 19,380 471 11.66 1% 0% 100% 0%
20 Node js #2 14.18 77,952 405 14.19 0% 1% 0% 99%
20 Node js #3 14.19 78,028 431 14.20 0% 84% 15% 1%
21 Free Pascal 14.63 19,696 3054 14.63 0% 100% 0% 0%
23 Ruby 16.56 104,192 524 16.55 0% 0% 100% 0%
464 PHP 5 min 19,396 756 5 min 100% 0% 0% 0%
Lua #7 Failed
Lua #5 Failed
Lua Failed
OCaml #7 Make Error
Perl #2 Failed
Perl #4 Failed
Python 3 #5 Failed
Matz's Ruby Bad Output
 
 
  hand-written vector instructions | "unsafe" | naked ffi
 
× source secs mem gz cpu secs cpu load
1.0 Chapel #4 0.75 19,648 515 0.76 98% 0% 2% 1%
1.2 C++ g++ #5 0.86 19,804 804 0.86 100% 0% 0% 2%
1.2 Free Pascal #3 0.87 19,824 493 0.87 98% 0% 1% 0%
1.2 Classic Fortran #4 0.87 19,728 987 0.87 1% 1% 100% 0%
1.2 Rust 0.88 19,660 1426 0.88 100% 0% 0% 0%
1.2 Ada 2012 GNAT #2 0.88 19,712 1137 0.88 2% 1% 100% 0%
1.2 Rust #3 0.88 19,660 1373 0.88 1% 2% 100% 0%
1.2 Rust #2 0.88 19,660 1312 0.88 0% 1% 100% 1%
1.2 Swift #2 0.88 19,684 606 0.88 100% 0% 0% 1%
1.3 C# .NET #5 0.92 34,692 990 0.94 97% 1% 4% 0%
1.3 Java #3 0.93 40,860 770 0.96 1% 98% 2% 2%
1.3 Go #4 0.95 19,808 689 0.97 98% 0% 3% 1%
1.4 C# .NET #6 0.96 32,836 1182 0.94 96% 0% 1% 1%
1.4 F# .NET #6 0.97 31,460 917 0.95 3% 1% 96% 0%
1.4 Julia #3 1.00 240,640 512 1.13 86% 3% 23% 1%
1.6 Julia #2 1.11 247,808 686 1.24 3% 8% 98% 1%
1.8 Python 3 #3 1.31 19,784 573 1.31 100% 0% 2% 0%
1.9 Racket #2 1.34 79,072 1142 1.34 2% 0% 100% 0%
1.9 Java #2 1.34 44,524 944 1.42 0% 3% 97% 4%
1.9 F# .NET #4 1.35 33,388 887 1.37 1% 3% 97% 0%
1.9 C# .NET #4 1.36 33,556 1135 1.35 1% 0% 98% 0%
2.2 Go #3 1.58 19,824 610 1.62 32% 44% 9% 21%
7.5 Free Pascal #2 5.36 19,696 802 5.36 0% 0% 100% 0%
7.5 Ada 2012 GNAT 5.36 19,712 1163 5.36 0% 100% 0% 0%
167 Haskell GHC #5 119.18 19,668 934 119.32 0% 0% 100% 0%