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.44 19,808 368 Lisp SBCL #3 3.32 785,792 499 Racket 10.41 77,992 459 × source secs mem gz cpu secs cpu load 1.0 Rust #4 0.71 19,804 804 0.71 100% 0% 1% 0% 1.1 Chapel #2 0.76 19,680 423 0.77 98% 0% 1% 1% 1.1 C gcc #2 0.82 19,704 422 0.82 100% 1% 1% 1% 1.2 C gcc 0.89 19,704 459 0.88 1% 100% 0% 1% 1.2 C++ g++ #4 0.89 19,736 521 0.88 1% 1% 1% 100% 1.3 PHP #5 0.96 19,932 405 0.96 100% 1% 1% 0% 1.4 PHP #4 0.98 19,804 396 0.98 0% 0% 1% 100% 1.4 PHP #3 0.98 19,804 510 0.98 0% 1% 100% 0% 1.5 Node.js #4 1.08 57,404 487 1.11 1% 100% 2% 1% 1.7 Go 1.18 19,808 715 1.20 1% 0% 72% 28% 2.0 Haskell GHC #6 1.44 19,808 368 1.52 2% 30% 40% 31% 2.1 PHP #2 1.47 19,932 552 1.47 0% 100% 0% 2% 2.1 Ruby yjit #5 1.50 1,011,072 494 1.50 100% 0% 2% 0% 2.1 Matz's Ruby #5 1.52 285,696 488 1.52 88% 2% 0% 12% 2.3 Haskell GHC #4 1.66 19,808 355 1.74 51% 3% 1% 48% 2.6 Go #2 1.84 19,808 740 1.89 38% 1% 29% 34% 2.9 Haskell GHC #3 2.05 19,808 387 2.12 21% 49% 14% 19% 2.9 Haskell GHC 2.07 19,808 466 2.14 3% 3% 72% 26% 2.9 Haskell GHC #2 2.08 19,808 592 2.14 30% 40% 3% 30% 3.4 Go #8 2.46 19,808 727 2.47 0% 100% 0% 1% 3.9 OCaml #5 2.75 19,676 465 2.75 0% 0% 100% 0% 4.0 Dart #2 2.86 19,808 496 2.90 0% 2% 99% 0% 4.3 Ruby yjit #2 3.10 2,431,144 666 3.09 100% 0% 1% 0% 4.4 Erlang #3 3.15 68,836 568 4.20 30% 69% 5% 29% 4.5 Dart #3 3.22 19,808 495 3.27 0% 99% 0% 0% 4.6 Erlang #2 3.26 75,544 518 5.16 27% 52% 26% 55% 4.7 Lisp SBCL #3 3.32 785,792 499 3.32 0% 0% 0% 99% 4.7 Lisp SBCL #4 3.33 793,088 495 3.33 100% 0% 0% 0% 4.7 Erlang 3.36 94,388 565 4.11 10% 23% 7% 81% 6.5 Python 3 #4 4.61 19,652 348 4.61 0% 0% 99% 0% 7.0 Go #7 4.99 19,808 702 5.61 31% 29% 26% 28% 8.4 Lisp SBCL #2 5.95 811,008 655 5.95 0% 0% 100% 0% 9.2 C# .NET #7 6.59 53,412 579 7.20 4% 37% 45% 23% 11 Java 7.63 491,600 807 8.66 34% 18% 28% 32% 12 VW Smalltalk #4 8.42 55,680 757 8.42 0% 99% 0% 0% 15 Racket 10.41 77,992 459 10.41 0% 100% 0% 0% 17 Node.js #2 12.35 85,896 405 12.38 0% 100% 1% 0% 18 Node.js #3 12.48 85,704 431 12.51 0% 99% 0% 0% 19 Perl 13.27 19,684 471 13.26 0% 100% 0% 0% 21 Free Pascal 14.68 19,720 3068 14.67 0% 0% 100% 0% 25 Ruby yjit 17.73 104,576 524 17.72 0% 100% 0% 0% 470 PHP 5 min 19,804 756 5 min 0% 100% 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 #2 Failed Matz's Ruby Bad Output hand-written vector instructions | "unsafe" | naked ffi × source secs mem gz cpu secs cpu load 1.0 Ada 2012 GNAT #2 0.74 19,568 1137 0.74 0% 0% 100% 1% 1.0 Rust #3 0.74 19,804 1373 0.74 0% 1% 100% 1% 1.0 Rust 0.74 19,804 1426 0.74 0% 100% 0% 0% 1.0 Rust #2 0.74 19,804 1312 0.74 1% 100% 2% 0% 1.0 Swift #2 0.75 19,440 606 0.75 0% 0% 0% 100% 1.1 Chapel #4 0.76 19,680 515 0.76 100% 1% 1% 2% 1.1 Go #4 0.82 19,808 689 0.83 100% 0% 0% 1% 1.2 C++ g++ #5 0.87 19,736 804 0.87 2% 0% 0% 100% 1.2 Free Pascal #3 0.87 20,008 536 0.87 0% 1% 0% 100% 1.2 Classic Fortran #4 0.88 19,652 987 0.88 2% 2% 100% 0% 1.3 C# .NET #5 0.93 35,096 990 0.96 4% 1% 1% 97% 1.3 Java #3 0.94 40,944 770 0.96 1% 98% 1% 3% 1.3 F# .NET #6 0.96 31,680 917 0.95 97% 1% 0% 2% 1.3 C# .NET #6 0.96 33,240 1182 0.95 0% 0% 3% 99% 1.4 Julia #3 1.02 244,096 512 1.15 85% 27% 1% 1% 1.6 Julia #2 1.13 252,060 686 1.26 8% 100% 3% 0% 1.7 Racket #2 1.18 79,120 1142 1.18 0% 0% 100% 0% 1.9 Python 3 #3 1.33 19,652 573 1.33 0% 0% 100% 0% 1.9 F# .NET #4 1.34 33,524 887 1.37 98% 0% 2% 3% 1.9 Java #2 1.35 44,528 944 1.42 4% 25% 3% 76% 1.9 C# .NET #4 1.36 33,952 1135 1.35 2% 99% 0% 1% 2.0 Go #3 1.40 19,808 610 1.44 41% 39% 16% 7% 6.3 Ada 2012 GNAT 4.49 19,568 1163 4.49 0% 0% 100% 0% 7.5 Free Pascal #2 5.37 19,672 834 5.37 0% 0% 100% 0% 139 Haskell GHC #5 98.91 19,808 934 99.06 91% 8% 0% 0% by secs by mem by gz by cpu secs