ant-design / ant-design/cssinjs

Performance degradation in antd with cssinjs compared to v4

Open
#199 3 comments 2 reactions 1 assignee Claimed by @MadCcc View on GitHub
Dominant language
TypeScript
Stars
287
Forks
80
PR merge metrics
No merged PRs in 30d

Description

Hi,

we are getting a quite significant performance degradation in our virtual scrolled component with a lot of Antd components inside. Below are screeenshots of FF profiler with cssinjs (antd v5) and without (antd v4). It seems like the bottleneck here is the `useToken -> useCacheToken -> useGlobalCache` code. In Chrome it seems `updateCSS` to be the issue.

1. Can you give more details, why CSS needs to be updated when we are scrolling virtual container? It seems to me that could be avoided, as nothing is changed with the component - it is just mounted / unmounted?
2. Can you give some hints about how to improve the performance. For now our component is not usable.

Ant5 - see the red Jank stripes
![image](https://github.com/user-attachments/assets/6219d26f-9cbb-4fdf-9d98-7a122ce6d823)

Ant4
![image](https://github.com/user-attachments/assets/61a76b09-447e-424e-86de-5423eb115425)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.