Haskell Pidigits GHC-5 update by Liam Zhu
Haskell GHC-5 update by Liam Zhu
Source code
Code changed and cleaned up very slightly, now using CApiFFI extension, which is the preferred way to call C. This results in a substantially faster program.
https://salsa.debian.org/Liamzy/haskell-benchmark-rigs/-/blob/main/pidigits8.hs pidigits8.hs
Provide an example build command-line
Build on M3 silicon:
ghc --make -fllvm -O2 -XBangPatterns -threaded -rtsopts pidigits8.hs -o pidigits.ghc-8.ghc_run -I/opt/homebrew/opt/gmp/include/
Informal comparisons:
./pidigits.ghc-8.ghc_run +RTS -N4 -RTS 10000 0.31s user 0.02s system 93% cpu 0.353 total
./pidigits.ghc-8.ghc_run +RTS -N1 -RTS 10000 0.32s user 0.01s system 96% cpu 0.344 total
./pidigits.gcc-2.gcc_run 10000 0.31s user 0.01s system 98% cpu 0.318 total
Edited by William Zhu