You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Click "Addom" to open the console and check the console output
` run loop 10000 begin 1683368575551 run loop 10000 end 1217ms `
10,000 nodes require 1200ms to render
Check the time consumption time consumption time is checked by the performance tools in Devtool, and sorted in the time consumption.
Time (μs)
Quickly reject count
Matching attempt
Matching count
Selector
767044
0
10000
0
a [nz-tab-link] ~ *
2738
0
9999
9999
DIV
2610
0
10000
0
span.ant-radio *
1955
0
10000
9999
DIV [_ngContent-GCQ-C44]
Discover a [nz-tab-link] ~ *This style occupies most of the calculation time
What is exfected?
When a large number of DOM adds a [nz-tab-link] ~ *Don't have so much impact on performance, it is not much different from other ordinary global styles.
What is actually happy?
a [nz-tab-link] ~ * occupies most of the CSS calculation time consumption time consumption
Reproduction link
https://codesandbox.io/s/angular15-ng-zorro-antd-tabs-component-css-performance-test-2fvfb5
Steps to reproduce
项目启动后,打开地址https://2fvfb5.csb.app/
点击“addDom”打开控制台,查看console输出
10000个节点需要1200ms才能渲染出来
通过DevTool中的性能工具查看样式计算耗时,按照耗时倒序排序后
发现a[nz-tab-link] ~ *这个样式占用了绝大部分计算时间
点击“clearDom”清除掉已经存在的DOM
这个时候点击“replace css (nz-tab-link ~ *)”按钮,把原始的
a[nz-tab-link] ~ * { position: relative; }
替换为.ant-tabs-tab a[nz-tab-link] ~ * { position: relative; }
之后再点击“addDom”,再次查看console输出渲染完毕的时间缩减到了300ms以内,性能有了大幅提升
What is expected?
大数量的dom 添加时a[nz-tab-link] ~ *不要对性能影响那么大,和其他普通的全局样式耗时相差不大即可
What is actually happening?
a[nz-tab-link] ~ * 占据了绝大部分的css计算耗时
The text was updated successfully, but these errors were encountered: