Advertisement
Guest User

infiniteRef SCC

a guest
Feb 10th, 2021
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Main (main) where
  2.  
  3. main :: IO ()
  4. main = do
  5.   n1 <- {-# SCC "firstFibIO" #-} fibIO 105
  6.   n2 <- {-# SCC "secondFibIO" #-} fibIO 205
  7.   print n1
  8.   print n2
  9.  
  10. {-# SCC fibIO #-}
  11. fibIO :: Int -> IO Int
  12. fibIO n = pure $ fib2 n
  13.  
  14. {-# SCC fib2 #-}
  15. fib2 :: Int -> Int
  16. fib2 n = ({-# SCC "infiniteRef" #-} infinite) !! n
  17.   where
  18.     {-# NOINLINE infinite #-}
  19.     infinite = 1 : 1 : zipWith (+) infinite (tail infinite)
  20.  
  21.     Wed Feb 10 19:53 2021 Time and Allocation Profiling Report  (Final)
  22.  
  23.        expression-profiling +RTS -P -RTS
  24.  
  25.     total time  =        0.00 secs   (0 ticks @ 1000 us, 1 processor)
  26.     total alloc =      89,864 bytes  (excludes profiling overheads)
  27.  
  28. COST CENTRE MODULE           SRC                             %time %alloc  ticks     bytes
  29.  
  30. MAIN        MAIN             <built-in>                        0.0   15.7      0     14128
  31. CAF         GHC.IO.Handle.FD <entire-module>                   0.0   38.6      0     34704
  32. CAF         GHC.IO.Encoding  <entire-module>                   0.0    3.0      0      2656
  33. Main.fib2   Main             expression-profiling.hs:22:1-4    0.0   41.4      0     37232
  34.  
  35.  
  36.                                                                                            individual      inherited
  37. COST CENTRE      MODULE                SRC                              no.     entries  %time %alloc   %time %alloc  ticks     bytes
  38.  
  39. MAIN             MAIN                  <built-in>                       117           0    0.0   15.7     0.0  100.0      0     14128
  40.  secondFibIO     Main                  expression-profiling.hs:6:35-43  238           1    0.0    0.0     0.0   27.5      0         0
  41.   Main.fibIO     Main                  expression-profiling.hs:12:1-5   239           1    0.0    0.1     0.0   27.5      0        72
  42.    Main.fib2     Main                  expression-profiling.hs:22:1-4   242           1    0.0   27.4     0.0   27.4      0     24616
  43.     infiniteRef  Main                  expression-profiling.hs:22:37-44 243           1    0.0    0.0     0.0    0.0      0         0
  44.  CAF             Main                  <entire-module>                  233           0    0.0    0.1     0.0   14.2      0        72
  45.   firstFibIO     Main                  expression-profiling.hs:5:34-42  234           1    0.0    0.0     0.0   14.1      0         0
  46.    Main.fibIO    Main                  expression-profiling.hs:12:1-5   235           1    0.0    0.1     0.0   14.1      0        72
  47.     Main.fib2    Main                  expression-profiling.hs:22:1-4   240           1    0.0   14.0     0.0   14.0      0     12616
  48.      infiniteRef Main                  expression-profiling.hs:22:37-44 241           1    0.0    0.0     0.0    0.0      0         0
  49.  CAF             GHC.Conc.Signal       <entire-module>                  228           0    0.0    0.7     0.0    0.7      0       656
  50.  CAF             GHC.IO.Encoding       <entire-module>                  219           0    0.0    3.0     0.0    3.0      0      2656
  51.  CAF             GHC.IO.Encoding.Iconv <entire-module>                  217           0    0.0    0.2     0.0    0.2      0       200
  52.  CAF             GHC.IO.Handle.FD      <entire-module>                  209           0    0.0   38.6     0.0   38.6      0     34704
  53.  CAF             GHC.IO.Handle.Text    <entire-module>                  148           0    0.0    0.1     0.0    0.1      0        72
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement