Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Chrome render perf issue #1045

Merged
merged 2 commits into from May 9, 2024
Merged

fix: Chrome render perf issue #1045

merged 2 commits into from May 9, 2024

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented May 9, 2024

fix ant-design/ant-design#48833

之前以为是下拉框的性能问题,做了 diff 后发现没有关系。排查了一下:

当值包含中文时,在 Chrome 下会有巨幅的 layout 性能损耗,推测是中文的渲染问题。对于 Chrome 内核我们做不了,需要考虑做一些 workaround 绕过:

截屏2024-05-09 14 31 13

布局往前,有一个 29 微秒 的样式重绘。导致了巨大的 layout。

截屏2024-05-09 14 31 52

定位到 React 中,查看相关插入节点

截屏2024-05-09 14 32 56

发现节点变化来自于 输入框 部分,的确和 下拉框 无关

截屏2024-05-09 14 33 18

变化来自于 a11y 的 polite 的自动提示相关

截屏2024-05-09 14 34 07

代码中已经进行了空间裁剪,但是 Chrome 里会无视这部分进行全量渲染。考虑到读屏中,使用全量数据没有意义,调整 无障碍 提示量为 50 个。测试后修复:

截屏2024-05-09 14 43 12

Copy link

vercel bot commented May 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
select ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 9, 2024 6:44am

@zombieJ zombieJ merged commit fc5dfe7 into master May 9, 2024
9 checks passed
@zombieJ zombieJ deleted the fix-chrome branch May 9, 2024 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

【select】大数据渲染虚拟列表时,渲染中文卡顿
1 participant