Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

InkRippleService causes poor performance for clickable list items #4199

Closed
bvaughn opened this issue Aug 17, 2015 · 2 comments
Closed

InkRippleService causes poor performance for clickable list items #4199

bvaughn opened this issue Aug 17, 2015 · 2 comments
Assignees
Labels
severity: performance This issue causes a significant performance degradation type: performance This issue is related to performance ui: ink
Milestone

Comments

@bvaughn
Copy link

bvaughn commented Aug 17, 2015

I recently spent some time debugging a performance problem with a list of clickable items (mdListItem with sibling ngClick directive). Using the Chrome Timeline tool I saw that nearly all of the delay was spent "recalculating style" (the purple boxes):
screen shot 2015-08-17 at 9 19 31 am

Drilling down further I noticed that every one of these style calculations was reported as "forced" by Chrome, and attributed to the InkRippleService's use of window.getComputedStyle:

    var rippleSize,
        controller = element.controller('mdInkRipple') || {},
        counter = 0,
        ripples = [],
        states = [],
        isActiveExpr = element.attr('md-highlight'),
        isActive = false,
        isHeld = false,
        node = element[0],
        rippleSizeSetting = element.attr('md-ripple-size'),
        color = parseColor(element.attr('md-ink-ripple')) || parseColor(options.colorElement.length && $window.getComputedStyle(options.colorElement[0]).color || 'rgb(0, 0, 0)');

Apparently the presence of ng-click causes the list items to use the ink rippled effect (see issue #904) which then results in this forced style calculation. Could this calculation not be deferred until the item was actually clicked (aka when the ripple effect was actually required)?

FYI removing the ng-click attribute from my md-list-item reduced the event handler execution time from 180ms to 54ms.

@ThomasBurleson ThomasBurleson added ui: ink type: performance This issue is related to performance severity: performance This issue causes a significant performance degradation labels Aug 17, 2015
@ThomasBurleson ThomasBurleson added this to the 0.11.0 milestone Aug 17, 2015
@ThomasBurleson
Copy link
Contributor

@bvaughn - really nice track-down effort here. The good news is a that we have a complete rewrite of Ripples pending in #4166. A merge to master is planned soon.

@bvaughn
Copy link
Author

bvaughn commented Aug 17, 2015

Thank you Thomas :)

I'm happy to hear that! Thanks for the update.

robertmesserle pushed a commit that referenced this issue Aug 17, 2015
…n and providing more control over the ripples states

Closes #4166

Closes #4199
Closes #3952
Closes #3346
Closes #2905
Closes #2636
Closes #2149
Closes #1597
Closes #1595
Closes #1398
kennethcachia pushed a commit to kennethcachia/material that referenced this issue Sep 23, 2015
…n and providing more control over the ripples states

Closes angular#4166

Closes angular#4199
Closes angular#3952
Closes angular#3346
Closes angular#2905
Closes angular#2636
Closes angular#2149
Closes angular#1597
Closes angular#1595
Closes angular#1398
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: performance This issue causes a significant performance degradation type: performance This issue is related to performance ui: ink
Projects
None yet
Development

No branches or pull requests

3 participants