Commit f711d17
Micro-optimise JavaScript part of Animated (#52906)
Summary:
Pull Request resolved: #52906
changelog: [internal]
Micro-optimise JavaScript part of Animated by avoiding JS syntax for private variable/method - #foo. Instead, use double underscores. Benchmarks indicate ~10% improvement.
# Before
### Animated (mode 🚀) ###
| (index) | Task name | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | ---------------------------------------------------------------------------- | --------------------- | ------------------------ | -------------------------- | ------------------------- | ------- |
| 0 | 'render 1 views' | '84990.06 ± 1.49%' | '80691.00' | '12164 ± 0.14%' | '12393' | 11767 |
| 1 | 'render 10 views' | '373372.50 ± 1.00%' | '363786.00' | '2727 ± 0.26%' | '2749' | 2679 |
| 2 | 'render 100 views' | '3099588.37 ± 0.92%' | '3017559.00' | '324 ± 0.74%' | '331' | 323 |
| 3 | 'render 1 animated views (without animations set up)' | '174636.87 ± 0.67%' | '168783.00' | '5808 ± 0.17%' | '5925' | 5727 |
| 4 | 'render 10 animated views (without animations set up)' | '1054481.51 ± 0.61%' | '1036686.00' | '953 ± 0.37%' | '965' | 949 |
| 5 | 'render 100 animated views (without animations set up)' | '9176283.60 ± 1.12%' | '8932316.00' | '109 ± 0.95%' | '112' | 109 |
| 6 | 'render 1 animated views (with a single animation set up - JS driven)' | '204383.77 ± 0.52%' | '199109.00' | '4943 ± 0.17%' | '5022' | 4893 |
| 7 | 'render 10 animated views (with a single animation set up - JS driven)' | '1315894.97 ± 0.36%' | '1300562.00 ± 40.00' | '762 ± 0.30%' | '769' | 760 |
| 8 | 'render 100 animated views (with a single animation set up - JS driven)' | '11924031.45 ± 1.36%' | '11753334.50 ± 30040.50' | '84 ± 1.18%' | '85' | 84 |
| 9 | 'render 1 animated views (with a single animation set up - native driven)' | '318103.70 ± 0.37%' | '311657.50 ± 0.50' | '3162 ± 0.20%' | '3209' | 3144 |
| 10 | 'render 10 animated views (with a single animation set up - native driven)' | '2230305.96 ± 0.51%' | '2191890.00' | '449 ± 0.41%' | '456' | 449 |
| 11 | 'render 100 animated views (with a single animation set up - native driven)' | '21983695.16 ± 0.75%' | '21945687.00 ± 17186.00' | '46 ± 0.74%' | '46' | 64 |
# After
### Animated (mode 🚀) ###
| (index) | Task name | Latency average (ns) | Latency median (ns) | Throughput average (ops/s) | Throughput median (ops/s) | Samples |
| ------- | ---------------------------------------------------------------------------- | --------------------- | ----------------------- | -------------------------- | ------------------------- | ------- |
| 0 | 'render 1 views' | '82684.75 ± 1.11%' | '80231.00' | '12331 ± 0.08%' | '12464' | 12095 |
| 1 | 'render 10 views' | '378798.65 ± 1.16%' | '365378.50 ± 9.50' | '2703 ± 0.31%' | '2737' | 2640 |
| 2 | 'render 100 views' | '3124253.51 ± 0.95%' | '3039842.00' | '322 ± 0.76%' | '329' | 321 |
| 3 | 'render 1 animated views (without animations set up)' | '165580.70 ± 0.73%' | '161562.00' | '6131 ± 0.14%' | '6190' | 6040 |
| 4 | 'render 10 animated views (without animations set up)' | '979127.10 ± 0.60%' | '962509.50 ± 5.50' | '1027 ± 0.36%' | '1039' | 1022 |
| 5 | 'render 100 animated views (without animations set up)' | '8487740.98 ± 1.32%' | '8235139.50 ± 3244.50' | '118 ± 1.05%' | '121' | 118 |
| 6 | 'render 1 animated views (with a single animation set up - JS driven)' | '185333.93 ± 0.52%' | '181582.00' | '5451 ± 0.15%' | '5507' | 5396 |
| 7 | 'render 10 animated views (with a single animation set up - JS driven)' | '1145679.81 ± 0.37%' | '1131668.00' | '875 ± 0.29%' | '884' | 873 |
| 8 | 'render 100 animated views (with a single animation set up - JS driven)' | '10451056.69 ± 1.60%' | '10064069.50 ± 826.50' | '96 ± 1.39%' | '99' | 96 |
| 9 | 'render 1 animated views (with a single animation set up - native driven)' | '292243.89 ± 0.40%' | '286740.00' | '3447 ± 0.21%' | '3487' | 3422 |
| 10 | 'render 10 animated views (with a single animation set up - native driven)' | '1993053.78 ± 0.47%' | '1958960.00 ± 20.00' | '503 ± 0.39%' | '510' | 502 |
| 11 | 'render 100 animated views (with a single animation set up - native driven)' | '19528221.48 ± 0.95%' | '19383511.00 ± 7431.00' | '51 ± 0.92%' | '52' | 64 |
Reviewed By: rubennorte
Differential Revision: D79179369
fbshipit-source-id: e641be0e8ec313b58bcae8330f127e707cd4fffc1 parent 0d3791c commit f711d17
7 files changed
Lines changed: 97 additions & 97 deletions
File tree
- packages/react-native/Libraries/Animated
- animations
- nodes
Lines changed: 14 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
| 86 | + | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
| 188 | + | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
Lines changed: 30 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
| 195 | + | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
| 216 | + | |
| 217 | + | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
| 249 | + | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
| 256 | + | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | | - | |
| 261 | + | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
| 309 | + | |
| 310 | + | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| |||
0 commit comments