Skip to content

Commit db6a33a

Browse files
mnajdovaoliviertassinarimbrookeseps1lon
authored
[docs] Improve documentation of the system (#23294)
Co-authored-by: Olivier Tassinari <[email protected]> Co-authored-by: Matt <[email protected]> Co-authored-by: Matt Brookes <[email protected]> Co-authored-by: eps1lon <[email protected]>
1 parent a282900 commit db6a33a

File tree

41 files changed

+888
-612
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+888
-612
lines changed

benchmark/browser/README.md

Lines changed: 31 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -16,163 +16,45 @@ You should use these numbers exclusively for comparing performance between diffe
1616
yarn benchmark:browser
1717
1818
noop (baseline):
19-
20-
20.10ms
21-
20.05ms
22-
19.28ms
23-
19.64ms
24-
20.96ms
25-
18.80ms
26-
18.39ms
27-
20.38ms
28-
18.85ms
29-
18.99ms
19+
mean: 4.70ms, median: 4.72ms
3020
-------------
31-
Avg: 19.55ms
32-
Median: 19.46ms
33-
34-
styled-components Box + @material-ui/system:
35-
36-
184.17ms
37-
161.51ms
38-
168.84ms
39-
165.21ms
40-
163.43ms
41-
158.10ms
42-
158.81ms
43-
297.91ms
44-
161.25ms
45-
158.87ms
21+
React primitives:
22+
mean: 68.89ms, median: 64.02ms
4623
-------------
47-
Avg: 177.81ms
48-
Median: 162.47ms
49-
50-
styled-components Box + styled-system:
51-
52-
142.66ms
53-
146.55ms
54-
141.12ms
55-
141.04ms
56-
139.45ms
57-
145.63ms
58-
141.36ms
59-
134.98ms
60-
123.98ms
61-
146.09ms
24+
React components:
25+
mean: 74.38ms, median: 74.46ms
6226
-------------
63-
Avg: 140.29ms
64-
Median: 141.24ms
65-
66-
Box emotion:
67-
68-
143.21ms
69-
135.28ms
70-
122.53ms
71-
124.80ms
72-
143.69ms
73-
147.81ms
74-
138.16ms
75-
124.55ms
76-
140.32ms
77-
157.74ms
27+
Styled Material-UI:
28+
mean: 109.73ms, median: 109.46ms
7829
-------------
79-
Avg: 137.81ms
80-
Median: 139.24ms
81-
82-
Box @material-ui/styles:
83-
84-
146.16ms
85-
131.37ms
86-
139.43ms
87-
158.55ms
88-
149.54ms
89-
131.81ms
90-
134.84ms
91-
151.08ms
92-
152.30ms
93-
130.69ms
30+
Styled emotion:
31+
mean: 102.59ms, median: 104.28ms
9432
-------------
95-
Avg: 142.58ms
96-
Median: 142.79ms
97-
98-
Box styled-components:
99-
100-
145.59ms
101-
150.12ms
102-
179.04ms
103-
169.63ms
104-
148.21ms
105-
155.55ms
106-
182.55ms
107-
170.04ms
108-
153.14ms
109-
148.92ms
33+
Styled SC:
34+
mean: 104.06ms, median: 102.67ms
11035
-------------
111-
Avg: 160.28ms
112-
Median: 154.35ms
113-
114-
Basic styled-components box:
115-
116-
141.73ms
117-
139.71ms
118-
121.01ms
119-
120.02ms
120-
121.81ms
121-
143.22ms
122-
135.67ms
123-
120.85ms
124-
121.08ms
125-
120.59ms
36+
makeStyles:
37+
mean: 93.81ms, median: 92.90ms
12638
-------------
127-
Avg: 128.57ms
128-
Median: 121.44ms
129-
130-
Chakra-UI box component:
131-
132-
147.42ms
133-
128.51ms
134-
118.74ms
135-
110.01ms
136-
133.05ms
137-
130.20ms
138-
121.57ms
139-
119.11ms
140-
108.57ms
141-
134.90ms
39+
sx Material-UI box:
40+
mean: 187.98ms, median: 188.77ms
14241
-------------
143-
Avg: 125.21ms
144-
Median: 125.04ms
145-
146-
Theme-UI box sx prop:
147-
148-
165.02ms
149-
141.07ms
150-
139.19ms
151-
185.45ms
152-
166.16ms
153-
138.83ms
154-
140.56ms
155-
139.02ms
156-
179.26ms
157-
165.58ms
42+
Box Material-UI:
43+
mean: 159.24ms, median: 157.90ms
15844
-------------
159-
Avg: 156.01ms
160-
Median: 153.05ms
161-
162-
Theme-UI div sx prop:
163-
164-
131.07ms
165-
130.84ms
166-
130.99ms
167-
132.66ms
168-
132.24ms
169-
130.89ms
170-
131.11ms
171-
167.10ms
172-
154.42ms
173-
131.48ms
45+
sx Theme-UI box:
46+
mean: 164.22ms, median: 164.16ms
47+
-------------
48+
sx Theme-UI div:
49+
mean: 153.10ms, median: 152.77ms
50+
-------------
51+
Box Chakra-UI:
52+
mean: 154.95ms, median: 153.89ms
53+
-------------
54+
styled-components Box + @material-ui/system:
55+
mean: 176.82ms, median: 176.60ms
56+
-------------
57+
styled-components Box + styled-system:
58+
mean: 155.18ms, median: 154.63ms
17459
-------------
175-
Avg: 137.28ms
176-
Median: 131.30ms
177-
Done in 31.83s.
17860
```

benchmark/browser/index.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Component = requirePerfScenarios(scenarioSuitePath).default;
1515
const start = performance.now();
1616
let end;
1717

18-
function TestCase(props) {
18+
function Measure(props) {
1919
const ref = React.useRef(null);
2020

2121
React.useLayoutEffect(() => {
@@ -28,20 +28,18 @@ function TestCase(props) {
2828
};
2929
});
3030

31-
return (
32-
<React.Profiler id={scenarioSuitePath} onRender={logReactMetrics}>
33-
<div ref={ref}>{props.children}</div>
34-
</React.Profiler>
35-
);
31+
return <div ref={ref}>{props.children}</div>;
3632
}
3733

38-
TestCase.propTypes = {
34+
Measure.propTypes = {
3935
children: PropTypes.node,
4036
};
4137

4238
ReactDOM.render(
43-
<TestCase>
44-
<Component />
45-
</TestCase>,
39+
<React.Profiler id={scenarioSuitePath} onRender={logReactMetrics}>
40+
<Measure>
41+
<Component />
42+
</Measure>
43+
</React.Profiler>,
4644
rootEl,
4745
);

benchmark/browser/scenarios/basic-styled-components/index.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

benchmark/browser/scenarios/box-chakra-ui/index.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import * as React from 'react';
2-
import { Box, ThemeProvider, theme } from '@chakra-ui/core';
2+
import { Box, ThemeProvider } from '@chakra-ui/core';
33

4-
// Let's say you want to add custom colors
54
const customTheme = {
6-
...theme,
75
colors: {
8-
...theme.colors,
9-
brand: {
10-
900: '#1a365d',
11-
800: '#153e75',
12-
700: '#2a69ac',
13-
},
6+
text: '#000',
7+
background: '#fff',
8+
primary: '#33e',
149
},
1510
};
1611

@@ -19,13 +14,15 @@ export default function BoxChakraUi() {
1914
<ThemeProvider theme={customTheme}>
2015
{new Array(1000).fill().map(() => (
2116
<Box
22-
color="primary.main"
23-
bg="background.paper"
24-
fontWeight="semibold"
25-
fontSize={['30em', '48em', '62em', '80em']}
26-
p={[2, 3, 4]}
17+
width={200}
18+
height={200}
19+
color={'primary'}
20+
backgroundColor={['primary', 'text', 'background']}
21+
borderWidth={'3px'}
22+
borderColor={'white'}
23+
borderStyle={['dashed', 'solid', 'dotted']}
2724
>
28-
chakra-ui
25+
test case
2926
</Box>
3027
))}
3128
</ThemeProvider>

benchmark/browser/scenarios/box-emotion/index.js

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
import * as React from 'react';
2-
import { createMuiTheme } from '@material-ui/core/styles';
3-
import { ThemeProvider as StylesThemeProvider } from '@material-ui/styles';
4-
import BoxStyles from '@material-ui/core/Box';
5-
6-
const materialSystemTheme = createMuiTheme();
2+
import Box from '@material-ui/core/Box';
73

84
export default function BoxMaterialUIStyles() {
95
return (
10-
<StylesThemeProvider theme={materialSystemTheme}>
6+
<React.Fragment>
117
{new Array(1000).fill().map(() => (
12-
<BoxStyles
13-
color="primary.main"
14-
bgcolor="background.paper"
15-
fontFamily="h6.fontFamily"
16-
fontSize={['h6.fontSize', 'h4.fontSize', 'h3.fontSize']}
17-
p={[2, 3, 4]}
8+
<Box
9+
width={200}
10+
height={200}
11+
borderWidth="3px"
12+
borderColor="white"
13+
backgroundColor={{ sm: 'primary.main' }}
14+
borderStyle={{ sm: 'dashed' }}
1815
>
19-
@material-ui/styles
20-
</BoxStyles>
16+
test case
17+
</Box>
2118
))}
22-
</StylesThemeProvider>
19+
</React.Fragment>
2320
);
2421
}

benchmark/browser/scenarios/box-styled-components/index.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)