{"action":"created","issue":{"url":"https://api.github.com/repos/angular/material2/issues/1570","repository_url":"https://api.github.com/repos/angular/material2","labels_url":"https://api.github.com/repos/angular/material2/issues/1570/labels{/name}","comments_url":"https://api.github.com/repos/angular/material2/issues/1570/comments","events_url":"https://api.github.com/repos/angular/material2/issues/1570/events","html_url":"https://github.com/angular/material2/issues/1570","id":184655404,"number":1570,"title":"[spinner @alpha 9] AoT compilation causes high CPU use via requestAnimationFrame()","user":{"login":"RoxKilly","id":12346501,"avatar_url":"https://avatars.githubusercontent.com/u/12346501?v=3","gravatar_id":"","url":"https://api.github.com/users/RoxKilly","html_url":"https://github.com/RoxKilly","followers_url":"https://api.github.com/users/RoxKilly/followers","following_url":"https://api.github.com/users/RoxKilly/following{/other_user}","gists_url":"https://api.github.com/users/RoxKilly/gists{/gist_id}","starred_url":"https://api.github.com/users/RoxKilly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoxKilly/subscriptions","organizations_url":"https://api.github.com/users/RoxKilly/orgs","repos_url":"https://api.github.com/users/RoxKilly/repos","events_url":"https://api.github.com/users/RoxKilly/events{/privacy}","received_events_url":"https://api.github.com/users/RoxKilly/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-22T21:34:12Z","updated_at":"2016-11-04T01:43:25Z","closed_at":null,"body":"#### Bug, feature request, or proposal:\n\nBug\n#### What is the expected behavior?\n- `md-spinner` should not use more CPU when app is AoT compiled than when it is JiT compiled\n- `md-spinner` should not use CPU resources once it is taken out of the DOM\n#### What is the current behavior?\n\nApp uses AoT compilation (JiT is not affected) and has `<md-spinner>` in the template\n- High CPU usage even once the spinner is removed from the DOM\n- `Zonetask.invoke` calls [`window.requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) in an infinite loop, choking the CPU\n- Minimizing the browser brings CPU utilization down. Restoring does the opposite\n#### What are the steps to reproduce?\n\n**app.component.html**\n\n```\n<md-card-content *ngIf=\"loading\">\n    <md-spinner></md-spinner>\n</md-card-content>\n<md-card-content *ngIf=\"!loading\">\n    Content goes here\n</md-card-content>\n```\n\n`loading===true` when `AppComponent` loads, so the spinner is shown. In `ngOnInit`, after data fetched from the server is received, `loading=false`.  The spinner disappears but CPU utilization remains high.  This only affects AoT app (not in-browser compiled JiT app).\n\nI replaced\n\n```\n<md-spinner></md-spinner>\n```\n\nwith...\n\n```\n<md-progress-bar mode=\"indeterminate\"></md-progress-bar>\n```\n\nand I no longer experience the problem.\n#### What is the use-case or motivation for changing an existing behavior?\n\nThis makes `md-spinner` too costly to use with `AoT compilation`\n#### Which versions of Angular, Material, OS, browsers are affected?\n\nTested on `Angular 2.0.1`, `@angular/compiler-cli 0.6.4`, `Material 9-3`, `Firefox 49`, `Chrome 54`, `Windows 7 x64`\n#### Is there anything else we should know?\n\nGet more details [from this issue](https://github.com/angular/angular/issues/12253#issuecomment-254139552)\n"},"comment":{"url":"https://api.github.com/repos/angular/material2/issues/comments/258324311","html_url":"https://github.com/angular/material2/issues/1570#issuecomment-258324311","issue_url":"https://api.github.com/repos/angular/material2/issues/1570","id":258324311,"user":{"login":"jelbourn","id":838736,"avatar_url":"https://avatars.githubusercontent.com/u/838736?v=3","gravatar_id":"","url":"https://api.github.com/users/jelbourn","html_url":"https://github.com/jelbourn","followers_url":"https://api.github.com/users/jelbourn/followers","following_url":"https://api.github.com/users/jelbourn/following{/other_user}","gists_url":"https://api.github.com/users/jelbourn/gists{/gist_id}","starred_url":"https://api.github.com/users/jelbourn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelbourn/subscriptions","organizations_url":"https://api.github.com/users/jelbourn/orgs","repos_url":"https://api.github.com/users/jelbourn/repos","events_url":"https://api.github.com/users/jelbourn/events{/privacy}","received_events_url":"https://api.github.com/users/jelbourn/received_events","type":"User","site_admin":false},"created_at":"2016-11-04T01:43:25Z","updated_at":"2016-11-04T01:43:25Z","body":"@RoxKilly an experimental release for alpha.10 with this fix is on npm under the `@experimental` tag- does the change improve what you had been seeing?"}}
{"actor":{"display_login":"jelbourn"}}