Skip to content

Instantly share code, notes, and snippets.

@clockfort
Created July 16, 2013 18:38
Show Gist options
  • Save clockfort/6011388 to your computer and use it in GitHub Desktop.
Save clockfort/6011388 to your computer and use it in GitHub Desktop.
show gambogi powers in haskell and their relative speed in square case
Prelude> sum $ map (\n -> n*n) [1..1024*1024*10]
384307223177865461760
it :: Integer
(5.20 secs, 3756611120 bytes)
Prelude> sum $ map (\n -> n**2) [1..1024*1024*10]
3.843072231783101e20
it :: Double
(5.65 secs, 3960924248 bytes)
Prelude> sum $ map (\n -> n^2) [1..1024*1024*10]
384307223177865461760
it :: Integer
(10.70 secs, 9549744736 bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment