Created
March 10, 2012 05:50
-
-
Save VoQn/2010442 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sat Mar 10 14:38 2012 Time and Allocation Profiling Report (Final) | |
basicFib +RTS -p -RTS | |
total time = 1.82 secs (91 ticks @ 20 ms) | |
total alloc = 7,947,854,776 bytes (excludes profiling overheads) | |
COST CENTRE MODULE %time %alloc | |
CAF Main 100.0 100.0 | |
individual inherited | |
COST CENTRE MODULE no. entries %time %alloc %time %alloc | |
MAIN MAIN 1 0 0.0 0.0 100.0 100.0 | |
CAF Main 238 2 100.0 100.0 100.0 100.0 | |
CAF GHC.IO.Handle.FD 175 2 0.0 0.0 0.0 0.0 | |
CAF GHC.IO.Encoding.Iconv 136 2 0.0 0.0 0.0 0.0 | |
CAF GHC.Conc.Signal 129 1 0.0 0.0 0.0 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main :: IO () | |
main = print $ fib 40 | |
fib :: Integer -> Integer | |
fib n | |
| n < 2 = 1 | |
| otherwise = fib ( n - 2 ) + fib ( n - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main :: IO () | |
main = print $ fib 40 | |
fib :: Integer -> Integer | |
fib = iter 1 0 0 1 | |
iter :: Integer -> Integer -> Integer -> Integer -> Integer -> Integer | |
iter _ b _ _ 0 = b | |
iter a b p q n | |
| even n = iter a b (p ^ 2 + q ^ 2) (q ^ 2 + 2 * p * q) (n `div` 2) | |
| otherwise = iter (b * q + a * (q + p)) (q * a + p * b) p q ( n - 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sat Mar 10 14:48 2012 Time and Allocation Profiling Report (Final) | |
fastFib +RTS -p -RTS | |
total time = 0.00 secs (0 ticks @ 20 ms) | |
total alloc = 10,216 bytes (excludes profiling overheads) | |
COST CENTRE MODULE %time %alloc | |
CAF GHC.Conc.Signal 0.0 6.6 | |
CAF GHC.IO.Encoding.Iconv 0.0 19.1 | |
CAF GHC.IO.Handle.FD 0.0 22.6 | |
CAF Main 0.0 25.0 | |
MAIN MAIN 0.0 26.7 | |
individual inherited | |
COST CENTRE MODULE no. entries %time %alloc %time %alloc | |
MAIN MAIN 1 0 0.0 26.7 0.0 100.0 | |
CAF Main 238 2 0.0 25.0 0.0 25.0 | |
CAF GHC.IO.Handle.FD 175 2 0.0 22.6 0.0 22.6 | |
CAF GHC.IO.Encoding.Iconv 136 2 0.0 19.1 0.0 19.1 | |
CAF GHC.Conc.Signal 129 1 0.0 6.6 0.0 6.6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment