Skip to content

Use quotRemWord in showWord

Sylvain Henry requested to merge hsyl20/ghc:hsyl20/showword into master
Use quotRemWord in showWord

Using the following high-quality benchmark (with -O2):

  main :: IO ()
  main = do
    let
      go 0         = ""
      go n@(W# n#) = showWord n# (go (n -1))
    print $ length (go 10000000)

I get the following performance results:

- remWord+quotRem: 0,76s user 0,00s system 99% cpu 0,762 total
- quotRemWord:     0,45s user 0,01s system 99% cpu 0,456 total

Note that showSignedInt already uses quotRemInt.

Merge request reports