Last active
August 29, 2015 14:04
-
-
Save topokel/0eef13a484cb0876d392 to your computer and use it in GitHub Desktop.
Helm Example Code Memory Leak
This file contains hidden or 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
| import FRP.Helm | |
| import qualified FRP.Helm.Window as Window | |
| render :: (Int, Int) -> Element | |
| render (w, h) = collage w h [move (100, 100) $ filled red $ square 64] | |
| main :: IO () | |
| main = do | |
| engine <- startup defaultConfig | |
| run engine $ render <~ Window.dimensions engine |
This file contains hidden or 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
| Wed Jul 23 15:07 2014 Time and Allocation Profiling Report (Final) | |
| Example1 +RTS -p -RTS | |
| total time = 9.82 secs (9822 ticks @ 1000 us, 1 processor) | |
| total alloc = 3,878,472 bytes (excludes profiling overheads) | |
| COST CENTRE MODULE %time %alloc | |
| main Main 99.9 82.1 | |
| render Main 0.1 16.9 | |
| individual inherited | |
| COST CENTRE MODULE no. entries %time %alloc %time %alloc | |
| MAIN MAIN 102 0 0.0 0.0 100.0 100.0 | |
| CAF Main 203 0 0.0 0.0 100.0 99.0 | |
| main Main 204 1 99.9 82.1 100.0 99.0 | |
| render Main 205 1386 0.1 16.9 0.1 16.9 | |
| CAF GHC.IO.Encoding 154 0 0.0 0.1 0.0 0.1 | |
| CAF GHC.Conc.Signal 144 0 0.0 0.0 0.0 0.0 | |
| CAF GHC.IO.Encoding.Iconv 138 0 0.0 0.0 0.0 0.0 | |
| CAF GHC.IO.Handle.FD 116 0 0.0 0.9 0.0 0.9 |
This file contains hidden or 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
| import FRP.Helm | |
| import qualified FRP.Helm.Keyboard as Keyboard | |
| import qualified FRP.Helm.Window as Window | |
| data State = State { mx :: Double, my :: Double } | |
| step :: (Int, Int) -> State -> State | |
| step (dx, dy) state = state { mx = (realToFrac dx) + mx state, | |
| my = (realToFrac dy) + my state } | |
| render :: (Int, Int) -> State -> Element | |
| render (w, h) (State { mx = mx, my = my }) = | |
| centeredCollage w h [move (mx, my) $ filled white $ square 100] | |
| main :: IO () | |
| main = do | |
| engine <- startup defaultConfig | |
| run engine $ render <~ Window.dimensions engine ~~ stepper | |
| where | |
| state = State { mx = 0, my = 0 } | |
| stepper = foldp step state Keyboard.arrows |
This file contains hidden or 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
| Wed Jul 23 15:11 2014 Time and Allocation Profiling Report (Final) | |
| Example2 +RTS -p -RTS | |
| total time = 9.79 secs (9795 ticks @ 1000 us, 1 processor) | |
| total alloc = 168,559,232 bytes (excludes profiling overheads) | |
| COST CENTRE MODULE %time %alloc | |
| main Main 95.7 3.5 | |
| main.stepper Main 4.0 95.7 | |
| individual inherited | |
| COST CENTRE MODULE no. entries %time %alloc %time %alloc | |
| MAIN MAIN 103 0 0.0 0.0 100.0 100.0 | |
| CAF Main 205 0 0.0 0.0 100.0 100.0 | |
| main Main 206 1 95.7 3.5 100.0 100.0 | |
| render Main 210 1385 0.1 0.5 0.1 0.5 | |
| main.state Main 209 1 0.0 0.0 0.0 0.0 | |
| main.stepper Main 207 1 4.0 95.7 4.2 96.0 | |
| step Main 208 1385 0.2 0.3 0.2 0.3 | |
| my Main 212 1385 0.0 0.0 0.0 0.0 | |
| mx Main 211 1385 0.0 0.0 0.0 0.0 | |
| CAF GHC.IO.Encoding 155 0 0.0 0.0 0.0 0.0 | |
| CAF GHC.Conc.Signal 145 0 0.0 0.0 0.0 0.0 | |
| CAF GHC.IO.Encoding.Iconv 139 0 0.0 0.0 0.0 0.0 | |
| CAF GHC.IO.Handle.FD 117 0 0.0 0.0 0.0 0.0 | |
| CAF GHC.Integer.Logarithms.Internals 110 0 0.0 0.0 0.0 0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment