-
Notifications
You must be signed in to change notification settings - Fork 3.4k
tabs: high cpu usage with certain styles and tab properties applied #9690
Description
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.8Angular Material Version:
1.1.0-rc4, 1.1.1
Additional Information:
Browser Type: *
ChromeBrowser Version: *
53OS: *
OS XStack Traces:
N/A
Thanks!