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.

tabs: high cpu usage with certain styles and tab properties applied #9690

@hitigon

Description

@hitigon

Actual Behavior:

With applying some certain CSS styles and properties on md-tabs, md-tabs can consume a lot of CPU resources, directly affecting the performance of web apps and browser.

CodePen :

An example on Codepen, http://codepen.io/anon/pen/WGpJaO
by changing the tabs' box properties (margin) and setting up md-center-tabs = true, the application constantly takes 13%~25% CPU.

I figured out that in tabController.js,

  if (ctrl.shouldCenterTabs) {
      var tabWidth = calcTabsWidth(elements.tabs);
      if (totalWidth > tabWidth) {
        $mdUtil.nextTick(updateInkBarStyles, false);
      }
    }

if the tabs are centered, there is a process queue that is trying to reposition a selected tab by computing the width. In my case, totalWidth > tabWidth always will be true.

If you notice that in my example, i also set md-no-ink and md-no-ink-bar, updateInkBarStyles seems not take them under consideration.

I understand this might be a rare case, but I don't think it is ideal to allow updateInkBarStyles to process continuously.

Angular Versions: *

  • Angular Version:1.5.7, 1.5.8
  • Angular Material Version: 1.1.0-rc4, 1.1.1

Additional Information:

  • Browser Type: * Chrome
  • Browser Version: * 53
  • OS: * OS X
  • Stack Traces: N/A

Thanks!

Metadata

Metadata

Assignees

Labels

P1: urgentUrgent issues that should be addressed in the next minor or patch release.g3: reportedThe issue was reported by an internal or external product team.has: Pull RequestA PR has been created to address this issueresolution: fixedseverity: performanceThis issue causes a significant performance degradationtype: performanceThis issue is related to performance

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions