Skip to content

Instantly share code, notes, and snippets.

@Transfusion
Created January 31, 2015 04:58
Show Gist options
  • Select an option

  • Save Transfusion/ab241029cebc1bdadd66 to your computer and use it in GitHub Desktop.

Select an option

Save Transfusion/ab241029cebc1bdadd66 to your computer and use it in GitHub Desktop.
Performance comparison in GHCi of various showInt implementations
$ ghci final2.hs
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( final2.hs, interpreted )
Ok, modules loaded: Main.
*Main> :set +s
*Main> (showInt $ product [1..80000]) !! 476674
'0'
(8.03 secs, 5944371624 bytes)
*Main> (showInt2 $ product [1..80000]) !! 476674
'0'
(7.81 secs, 5767286480 bytes)
*Main> (showInt3 $ product [1..80000]) !! 476674
'0'
(7.76 secs, 5759992568 bytes)
*Main> (showInt $ product [1..30000]) !! 161716
'0'
(1.17 secs, 815382200 bytes)
*Main> (showInt2 $ product [1..30000]) !! 161716
'0'
(1.08 secs, 755870168 bytes)
*Main> (showInt3 $ product [1..30000]) !! 161716
'0'
(1.08 secs, 753433680 bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment