ant-design / ant-design/cssinjs

Antd CSS-in-js performance comparison with styled-components and Emotion

Open
#84 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
287
Forks
80
PR merge metrics
No merged PRs in 30d

Description

CSS-in-Js performance testing

The data presents a comparison of the performance of three CSS-in-JS libraries: Styled Components, Emotion, and Antd (cssInJS). The performance is measured in two ways, the percentage of components that are successfully rendered and the total blocking time.

In terms of the percentage of components that are successfully rendered, the results are similar for the three libraries. As the number of components increases, the performance decreases for all three libraries. Styled Components and Emotion have a relatively higher performance compared to Antd cssInJS, especially at lower component numbers. For example, when the number of components is 10, Styled Components and Emotion have a performance of 97% and 96% respectively, while Antd cssInJS has a performance of only 90%.

In terms of total blocking time, the results show a clear difference between the three libraries. As the number of components increases, the total blocking time of Styled Components and Emotion increases at a slower pace compared to Antd cssInJS. For example, when the number of components is 200, the total blocking time of Styled Components is 350, Emotion is 450, while Antd cssInJS is 2450. This suggests that Styled Components and Emotion might be more suitable options for projects that require low total blocking time.

Total blocking time of Styled Components and Emotion also increases with increasing component numbers. At the highest number of components (5000), the total blocking time of Styled Components is 4540, Emotion is 5500, while Antd cssInJS's total blocking time is not possible to calculate.

PR: https://github.com/SmashTaps/css-in-js-solution-evaluation/pull/1#issue-1561476489

![Performance testing copy](https://user-images.githubusercontent.com/66440787/216141381-7df6ef55-3e9e-44b7-a4b3-42fb29c3c1cf.png)

React version : "^18.2.0"
AntD version : "^5.1.6"
Emotion : "^11.10.5"
Styled-component version : ^5.3.6"

Tested PC

Processor 11th Gen Intel(R) Core(TM) i5-11300H @ 3.10GHz 2.61 GHz
Installed RAM 16.0 GB
System type 64-bit operating system, x64-based processor

Contributor guide

No contributing guide indexed for this repository

Research direction

No repository files, tests, or entry points are named. Start by reviewing the linked pull request and the reported comparison for React 18.2.0, AntD 5.1.6, Emotion 11.10.5, and styled-components 5.3.6; the issue does not define a clear completion condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, performance, testing
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.