Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(progress-circle): improved rendering performance #1635

Merged
merged 1 commit into from
Nov 1, 2016

Conversation

crisbeto
Copy link
Member

Currently the progress circle hits ZoneJS on every animation frame, due to requestAnimationFrame. This change:

  • Wraps the requestAnimationFrame calls in runOutsideAngular in order to avoid hitting the change detection on every frame.
  • Switches from using an attribute binding to manipulating the path node directly.

Referencing #1570, #1511.

Note: I'm open to suggestions on better ways to fetch a reference to the path node. I've tried doing it in the constructor and in an OnInit method, but certain animations fire too early for the element to be rendered.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 27, 2016
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one minor comment.

* Renders the arc onto the SVG element. Proxies `getArc` while setting the proper
* DOM attribute on the `<path>`.
* @param {number} currentValue Current value to be rendered.
* @param {number} rotation Rotation of the circle.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the types from the JsDoc, since they're just part of the code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Currently the progress circle hits ZoneJS on every animation frame, due to `requestAnimationFrame`. This change:
* Wraps the `requestAnimationFrame` calls in `runOutsideAngular` in order to avoid hitting the change detection on every frame.
* Switches from using an attribute binding to manipulating the `path` node directly.

Referencing angular#1570, angular#1511.
@crisbeto crisbeto force-pushed the progress-circle-perf branch from c45c874 to 2f4976b Compare October 28, 2016 21:16
@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Nov 1, 2016
@hansl hansl merged commit 0883fb2 into angular:master Nov 1, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants