angular-docs-cn/goldens
Kristiyan Kostadinov 18b33e79d3 perf(core): avoid storing LView in __ngContext__ (#41358)
Currently we save a reference to an `LView` on most DOM nodes created by Angular either by saving
the `LView` directly in the `__ngContext__` or by saving the `LContext` which has a reference to
the `LView`. This can be a problem if the DOM node is retained in memory, because the `LView` has
references to all of the child nodes of the view, as well as other internal data structures.

Previously we tried to resolve the issue by clearing the `__ngContext__` when a node is removed
(see https://github.com/angular/angular/pull/36011), but we decided not to proceeed, because it can
slow down destruction due to a megamorphic write.

These changes aim to address the issue while reducing the performance impact by assigning a unique
ID when an `LView` is created and adding it to `__ngContext__`. All active views are tracked in
a map where their unique ID is used as the key. We don't need to worry about leaks within that map,
because `LView`s are an internal data structure and we have complete control over when they are
created and destroyed.

Fixes #41047.

PR Close #41358
2021-04-26 09:31:41 -07:00
..
circular-deps refactor(language-service): pull out interfaces on package toplevel (#40621) 2021-02-03 09:19:54 -08:00
public-api refactor(core): add single type for injector token (#41580) 2021-04-22 10:47:12 -07:00
size-tracking perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
BUILD.bazel ci: migrate payload size tracking goldens to the golden directory (#36455) 2020-04-24 09:05:11 -07:00
README.md ci: set up golden file for typescript circular dependencies (#35647) 2020-03-17 12:27:07 -07:00

README.md

public-api/

This directory contains all of the public api goldens for our npm packages we publish to NPM. These are tested on all PRs and commits as part of the our bazel tests.

To check or update the public api goldens, run one of the following commands:

yarn public-api:check
yarn public-api:update

packages-circular-deps.json

This golden file contains a list of all circular dependencies in the project. As part of the lint CI job we compare the current circular dependencies against this golden to ensure that we don't add more cycles. If cycles have been fixed, this file is also updated so that we can slowly burn down the number of cycles in the project.

To check or update the golden, run the following commands:

yarn ts-circular-deps:check
yarn ts-circular-deps:approve