Commit db49d42
refactor(compiler): generate less code for bindings to DOM elements
Detailed changes:
- remove `UNINITIALIZED`, initialize change detection fields with `undefined`.
* we use `view.numberOfChecks === 0` now everywhere
as indicator whether we are in the first change detection cycle
(previously we used this only in a couple of places).
* we keep the initialization itself as change detection get slower without it.
- remove passing around `throwOnChange` in various generated calls,
and store it on the view as property instead.
- change generated code for bindings to DOM elements as follows:
Before:
```
var currVal_10 = self.context.bgColor;
if (jit_checkBinding15(self.throwOnChange,self._expr_10,currVal_10)) {
self.renderer.setElementStyle(self._el_0,'backgroundColor',((self.viewUtils.sanitizer.sanitize(jit_21,currVal_10) == null)? null: self.viewUtils.sanitizer.sanitize(jit_21,currVal_10).toString()));
self._expr_10 = currVal_10;
}
var currVal_11 = jit_inlineInterpolate16(1,' ',self.context.data.value,' ');
if (jit_checkBinding15(self.throwOnChange,self._expr_11,currVal_11)) {
self.renderer.setText(self._text_1,currVal_11);
self._expr_11 = currVal_11;
}
```,
After:
```
var currVal_10 = self.context.bgColor;
jit_checkRenderStyle14(self,self._el_0,'backgroundColor',null,self._expr_10,self._expr_10=currVal_10,false,jit_21);
var currVal_11 = jit_inlineInterpolate15(1,' ',self.context.data.value,' ');
jit_checkRenderText16(self,self._text_1,self._expr_11,self._expr_11=currVal_11,false);
```
Performance impact:
- None seen (checked against internal latency lab)
Part of angular#136511 parent 8ed92d7 commit db49d42
File tree
23 files changed
+346
-286
lines changed- modules
- @angular
- compiler/src
- compiler_util
- view_compiler
- core/src
- change_detection
- linker
- forms/test
- upgrade/src
- aot
- benchmarks/src/tree
- ng2_ftl
- ng2_static_ftl
- ng2
- tools/public_api_guard/core
23 files changed
+346
-286
lines changedLines changed: 5 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 24 | + | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 28 | | |
47 | 29 | | |
48 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
Lines changed: 58 additions & 57 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | | - | |
23 | | - | |
24 | | - | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
38 | 35 | | |
39 | 36 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
47 | 44 | | |
48 | 45 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
66 | 62 | | |
67 | 63 | | |
68 | 64 | | |
69 | 65 | | |
70 | 66 | | |
71 | | - | |
| 67 | + | |
72 | 68 | | |
73 | 69 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 70 | + | |
| 71 | + | |
77 | 72 | | |
78 | | - | |
| 73 | + | |
79 | 74 | | |
80 | 75 | | |
81 | 76 | | |
| |||
84 | 79 | | |
85 | 80 | | |
86 | 81 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 82 | + | |
90 | 83 | | |
91 | 84 | | |
92 | | - | |
| 85 | + | |
93 | 86 | | |
94 | 87 | | |
95 | | - | |
| 88 | + | |
96 | 89 | | |
97 | 90 | | |
98 | 91 | | |
| |||
104 | 97 | | |
105 | 98 | | |
106 | 99 | | |
107 | | - | |
108 | 100 | | |
109 | 101 | | |
110 | 102 | | |
111 | 103 | | |
112 | 104 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 105 | + | |
| 106 | + | |
116 | 107 | | |
117 | 108 | | |
| 109 | + | |
118 | 110 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
123 | 115 | | |
124 | 116 | | |
125 | 117 | | |
| |||
151 | 143 | | |
152 | 144 | | |
153 | 145 | | |
154 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
155 | 156 | | |
Lines changed: 41 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | | - | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
183 | | - | |
| 184 | + | |
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
190 | | - | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
200 | | - | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| 210 | + | |
210 | 211 | | |
| 212 | + | |
211 | 213 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
217 | 230 | | |
218 | 231 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | 232 | | |
223 | 233 | | |
224 | 234 | | |
| 235 | + | |
| 236 | + | |
225 | 237 | | |
226 | | - | |
227 | | - | |
| 238 | + | |
228 | 239 | | |
229 | 240 | | |
230 | 241 | | |
| |||
240 | 251 | | |
241 | 252 | | |
242 | 253 | | |
243 | | - | |
244 | 254 | | |
245 | 255 | | |
246 | 256 | | |
| |||
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
258 | | - | |
259 | 268 | | |
260 | | - | |
| 269 | + | |
261 | 270 | | |
262 | 271 | | |
263 | 272 | | |
264 | | - | |
265 | | - | |
266 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
267 | 276 | | |
268 | | - | |
269 | | - | |
270 | | - | |
| 277 | + | |
| 278 | + | |
271 | 279 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | 280 | | |
276 | 281 | | |
277 | 282 | | |
| |||
381 | 386 | | |
382 | 387 | | |
383 | 388 | | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
388 | 392 | | |
389 | 393 | | |
390 | 394 | | |
391 | | - | |
| 395 | + | |
392 | 396 | | |
393 | 397 | | |
394 | 398 | | |
395 | 399 | | |
396 | | - | |
397 | | - | |
| 400 | + | |
| 401 | + | |
398 | 402 | | |
399 | 403 | | |
400 | 404 | | |
| |||
0 commit comments