{"action":"closed","issue":{"url":"https://api.github.com/repos/haskell-game/sdl2/issues/180","repository_url":"https://api.github.com/repos/haskell-game/sdl2","labels_url":"https://api.github.com/repos/haskell-game/sdl2/issues/180/labels{/name}","comments_url":"https://api.github.com/repos/haskell-game/sdl2/issues/180/comments","events_url":"https://api.github.com/repos/haskell-game/sdl2/issues/180/events","html_url":"https://github.com/haskell-game/sdl2/issues/180","id":318360057,"number":180,"title":"Performance of `clear`","user":{"login":"chrisdone","id":11019,"avatar_url":"https://avatars3.githubusercontent.com/u/11019?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisdone","html_url":"https://github.com/chrisdone","followers_url":"https://api.github.com/users/chrisdone/followers","following_url":"https://api.github.com/users/chrisdone/following{/other_user}","gists_url":"https://api.github.com/users/chrisdone/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdone/subscriptions","organizations_url":"https://api.github.com/users/chrisdone/orgs","repos_url":"https://api.github.com/users/chrisdone/repos","events_url":"https://api.github.com/users/chrisdone/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdone/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-27T10:35:23Z","updated_at":"2018-04-27T10:36:41Z","closed_at":"2018-04-27T10:36:41Z","author_association":"MEMBER","body":"It seems that even `clear` allocates, which is weird:\r\n\r\n```haskell\r\n-- | Test that merely polling and clearing the screen does not\r\n-- allocate or engage the GC.\r\npollEventClearTest :: Int -> IO ()\r\npollEventClearTest iters = do\r\n  initializeAll\r\n  window <- createWindow \"pollEventClearTest\" defaultWindow\r\n  renderer <- createRenderer window (-1) defaultRenderer\r\n  let go :: Int -> IO ()\r\n      go 0 = pure ()\r\n      go i = do\r\n        _ <- pollEvent\r\n        clear renderer\r\n        go (i - 1)\r\n  go iters\r\n```\r\n\r\n```\r\nCase                     Allocated  GCs\r\npollEvent + clear 1          2,864    0\r\npollEvent + clear 10         6,448    0\r\npollEvent + clear 100       35,968    0\r\npollEvent + clear 1000     331,168    0\r\npollEvent + clear 10000  3,283,336    6\r\n```\r\n\r\n"}}
{"actor":{"display_login":"chrisdone"}}