{"action":"created","issue":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/4049","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/4049/labels{/name}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/4049/comments","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/4049/events","html_url":"https://github.com/code-dot-org/code-dot-org/pull/4049","id":107264494,"number":4049,"title":"Perf: Speed up header rendering by not needing to include level/scrip…","user":{"login":"trevorb","id":17502,"avatar_url":"https://avatars.githubusercontent.com/u/17502?v=3","gravatar_id":"","url":"https://api.github.com/users/trevorb","html_url":"https://github.com/trevorb","followers_url":"https://api.github.com/users/trevorb/followers","following_url":"https://api.github.com/users/trevorb/following{/other_user}","gists_url":"https://api.github.com/users/trevorb/gists{/gist_id}","starred_url":"https://api.github.com/users/trevorb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trevorb/subscriptions","organizations_url":"https://api.github.com/users/trevorb/orgs","repos_url":"https://api.github.com/users/trevorb/repos","events_url":"https://api.github.com/users/trevorb/events{/privacy}","received_events_url":"https://api.github.com/users/trevorb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"philbogle","id":5198586,"avatar_url":"https://avatars.githubusercontent.com/u/5198586?v=3","gravatar_id":"","url":"https://api.github.com/users/philbogle","html_url":"https://github.com/philbogle","followers_url":"https://api.github.com/users/philbogle/followers","following_url":"https://api.github.com/users/philbogle/following{/other_user}","gists_url":"https://api.github.com/users/philbogle/gists{/gist_id}","starred_url":"https://api.github.com/users/philbogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philbogle/subscriptions","organizations_url":"https://api.github.com/users/philbogle/orgs","repos_url":"https://api.github.com/users/philbogle/repos","events_url":"https://api.github.com/users/philbogle/events{/privacy}","received_events_url":"https://api.github.com/users/philbogle/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-09-18T19:36:37Z","updated_at":"2015-09-18T21:23:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/4049","html_url":"https://github.com/code-dot-org/code-dot-org/pull/4049","diff_url":"https://github.com/code-dot-org/code-dot-org/pull/4049.diff","patch_url":"https://github.com/code-dot-org/code-dot-org/pull/4049.patch"},"body":"I was doing some poking around in newrelic and noticed loading the header view was ridiculously slow for some reason. \r\n\r\n![image](https://cloud.githubusercontent.com/assets/17502/9969101/52560714-5e01-11e5-8364-2f920d437826.png)\r\n\r\nhttps://rpm.newrelic.com/accounts/501463/applications/3787364/transactions?type=app#id=5b22436f6e74726f6c6c65722f7363726970745f6c6576656c732f73686f77222c22225d\r\n\r\nI tracked the slowness down to a function in user_model that includes a bunch of models that we no longer use in the query. (I checked everywhere we call this method, which is only like 2 places). I removed the includes as well as the stage param which is also no longer used.  This change cuts the header view rendering time to practically nothing."},"comment":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments/141572165","html_url":"https://github.com/code-dot-org/code-dot-org/pull/4049#issuecomment-141572165","issue_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/4049","id":141572165,"user":{"login":"trevorb","id":17502,"avatar_url":"https://avatars.githubusercontent.com/u/17502?v=3","gravatar_id":"","url":"https://api.github.com/users/trevorb","html_url":"https://github.com/trevorb","followers_url":"https://api.github.com/users/trevorb/followers","following_url":"https://api.github.com/users/trevorb/following{/other_user}","gists_url":"https://api.github.com/users/trevorb/gists{/gist_id}","starred_url":"https://api.github.com/users/trevorb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trevorb/subscriptions","organizations_url":"https://api.github.com/users/trevorb/orgs","repos_url":"https://api.github.com/users/trevorb/repos","events_url":"https://api.github.com/users/trevorb/events{/privacy}","received_events_url":"https://api.github.com/users/trevorb/received_events","type":"User","site_admin":false},"created_at":"2015-09-18T21:23:51Z","updated_at":"2015-09-18T21:23:51Z","body":"Yep, I removed the order clause and did the sorting in ruby which completely removes the query for script levels. \r\n\r\n \r\n<img width=\"626\" alt=\"screenshot 2015-09-18 14 23 03\" src=\"https://cloud.githubusercontent.com/assets/17502/9971473/d6d21f6e-5e10-11e5-9141-4294d75c343f.png\">\r\n"}}