Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
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

Description

@bvaughn

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.

Metadata

Metadata

Labels

severity: performanceThis issue causes a significant performance degradationtype: performanceThis issue is related to performanceui: ink

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions