Commit 1336297
perf(common): code size reduction of
This commit makes several changes to the implementation of `NgForOf` to
reduce its code size in production builds:
1. The tailor-made message for an unsupported differ is fully
tree-shaken in production builds, in favor of the exception from the
differ factory itself.
2. The private `_perViewChange` method was changed into a free-standing
function, to allow its name to be minimized.
3. The need for an intermediate `RecordViewTuple` was avoided by
applying the operation in-place, instead of collecting all insertions
into a buffer first. This is safe as the `_perViewChange` operation
that used to be done on each `RecordViewTuple` is entirely local to
the tuple itself. Hence, it is invariant to execution ordering which
means that the `_perViewChange` can be executed directly during the
`forEachOperation` loop.
PR Close #44315ngFor directive (#44315)1 parent 99d85cb commit 1336297
6 files changed
Lines changed: 43 additions & 46 deletions
File tree
- goldens/size-tracking
- packages
- common/src/directives
- core/test/bundling
- forms_reactive
- forms_template_driven
- todo
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
212 | 223 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | 224 | | |
217 | 225 | | |
218 | 226 | | |
| |||
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
226 | | - | |
| 234 | + | |
227 | 235 | | |
228 | | - | |
| 236 | + | |
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
232 | 240 | | |
233 | 241 | | |
234 | | - | |
235 | | - | |
| 242 | + | |
| 243 | + | |
236 | 244 | | |
237 | | - | |
238 | | - | |
239 | 245 | | |
240 | | - | |
| 246 | + | |
241 | 247 | | |
242 | 248 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
247 | 252 | | |
248 | 253 | | |
249 | 254 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
259 | 261 | | |
260 | 262 | | |
261 | 263 | | |
262 | | - | |
263 | | - | |
264 | | - | |
| 264 | + | |
| 265 | + | |
265 | 266 | | |
266 | 267 | | |
267 | 268 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | 269 | | |
274 | 270 | | |
275 | 271 | | |
| |||
282 | 278 | | |
283 | 279 | | |
284 | 280 | | |
285 | | - | |
286 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
287 | 284 | | |
288 | 285 | | |
289 | 286 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | 437 | | |
441 | 438 | | |
442 | 439 | | |
| |||
656 | 653 | | |
657 | 654 | | |
658 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | 422 | | |
426 | 423 | | |
427 | 424 | | |
| |||
644 | 641 | | |
645 | 642 | | |
646 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
647 | 647 | | |
648 | 648 | | |
649 | 649 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | 104 | | |
108 | 105 | | |
109 | 106 | | |
| |||
236 | 233 | | |
237 | 234 | | |
238 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
0 commit comments