Please sign in to comment.
perf(ivy): split hooks processing into init and check phases (#32131)
Angular hooks come after 2 flavours: - init hooks (OnInit, AfterContentInit, AfterViewInit); - check hooks (OnChanges, DoChanges, AfterContentChecked, AfterViewChecked). We need to do more processing for init hooks to ensure that those hooks are run once and only once for a given directive (even in case of errors). As soon as all init hooks execute to completion we are only left with the checks to execute. It turns out that keeping track of the remaining init hooks to execute is rather expensive (multiple LView flags reads, writes and checks). But we can observe that non of this tracking is needed as soon as all init hooks are completed. This PR takes advantage of the above observations and splits hooks processing functions into: - init-specific (slower but less common); - check-specific (faster and more common). NOTE: there is code duplication in this PR and it is left like this intentinally: hand-inlining this perf-critical code makes the view refresh process substentially faster. PR Close #32131
- Loading branch information...
Showing with 151 additions and 77 deletions.
- +1 −1 integration/_payload-limits.json
- +40 −49 packages/core/src/render3/hooks.ts
- +18 −3 packages/core/src/render3/instructions/container.ts
- +19 −3 packages/core/src/render3/instructions/select.ts
- +55 −12 packages/core/src/render3/instructions/shared.ts
- +6 −3 packages/core/test/bundling/cyclic_import/bundle.golden_symbols.json
- +5 −2 packages/core/test/bundling/hello_world/bundle.golden_symbols.json
- +7 −4 packages/core/test/bundling/todo/bundle.golden_symbols.json
Oops, something went wrong.