angular-cn/packages/core/test/render3
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
..
i18n perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
instructions perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
interfaces refactor(core): Create `TNodeType.Text` to display full template in `TView` debug (#39233) 2020-10-21 18:33:00 -07:00
ivy refactor(compiler): move factory out of injector definition (#41022) 2021-03-08 15:31:30 -08:00
jit refactor(compiler-cli): introduce declaration function to declare class metadata (#41200) 2021-04-12 10:41:17 -07:00
perf fix(core): not invoking object's toString when rendering to the DOM (#39843) 2020-11-30 15:49:57 -08:00
styling_next refactor(core): Ensure that `previousOrParentTNode` always belongs to current `TView`. (#38707) 2020-09-28 16:15:58 -04:00
util build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
BUILD.bazel test(core): tag `render3` test targets as ivy-only (#40127) 2021-01-06 08:28:03 -08:00
change_detection_spec.ts fix(core): markDirty() should only mark flags when really scheduling tick. (#39316) 2020-10-29 16:07:10 -07:00
common_with_def.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_ref_spec.ts refactor(core): clean up circular dependencies (#39722) 2020-11-18 09:15:29 -08:00
component_spec.ts refactor(compiler): move factory out of injector definition (#41022) 2021-03-08 15:31:30 -08:00
di_spec.ts test(core): verify that token IDs that exceed the bloom filter size are handled correctly (#40489) 2021-01-20 17:02:02 -08:00
domino.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
global_utils_spec.ts feat(core): introduce getDirectiveMetadata global debugging utility (#41525) 2021-04-13 16:06:32 -07:00
i18n_debug_spec.ts refactor(core): cleanup i18n/icu data structures (#39233) 2020-10-21 18:33:00 -07:00
imported_renderer2.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
instructions_spec.ts refactor(core): Change `TemplateFixture` to named parameters (#39233) 2020-10-21 18:32:59 -07:00
integration_spec.ts perf(core): avoid storing LView in __ngContext__ (#41358) 2021-04-26 09:31:41 -07:00
is_shape_of.ts refactor(core): Replace `ExpandoInstructions` with `HostBindingOpCodes` (#39301) 2020-10-22 09:35:48 -07:00
is_shape_of_spec.ts refactor(core): add debug ranges to `LViewDebug` with matchers (#38359) 2020-08-06 16:58:11 -07:00
jit_environment_spec.ts refactor(compiler-cli): introduce declaration function to declare class metadata (#41200) 2021-04-12 10:41:17 -07:00
listeners_spec.ts refactor(core): Consistent use of `HEADER_OFFSET` (in `ɵɵ*` instructions only) (#39233) 2020-10-21 18:33:00 -07:00
load_domino.ts refactor(core): remove unused fakeAsyncFallback and asyncFallback (#37879) 2020-11-20 08:34:59 -08:00
matchers.ts refactor(core): cleanup i18n/icu data structures (#39233) 2020-10-21 18:33:00 -07:00
matchers_spec.ts refactor(core): Consistent use of `HEADER_OFFSET` (in `ɵɵ*` instructions only) (#39233) 2020-10-21 18:33:00 -07:00
metadata_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
node_selector_matcher_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
perfCounter_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_spec.ts refactor(core): Change `TemplateFixture` to named parameters (#39233) 2020-10-21 18:32:59 -07:00
providers_spec.ts refactor(compiler): move factory out of injector definition (#41022) 2021-03-08 15:31:30 -08:00
query_spec.ts fix(core): `QueryList` should not fire changes if the underlying list did not change. (#40091) 2021-01-14 13:55:02 -08:00
render_util.ts refactor(core): remove the need for `ɵɵinjectPipeChangeDetectorRef()` (#41231) 2021-03-30 16:46:37 -07:00
renderer_factory_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
testing_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
utils.ts refactor(core): Rename `debugMatch` to `matchDebug` for consistency (#39233) 2020-10-21 18:33:00 -07:00
view_container_ref_spec.ts fix(core): `QueryList` should not fire changes if the underlying list did not change. (#40091) 2021-01-14 13:55:02 -08:00
view_fixture.ts fix(core): Store ICU state in `LView` rather than in `TView` (#39233) 2020-10-21 18:33:00 -07:00
view_utils_spec.ts fix(core): Store ICU state in `LView` rather than in `TView` (#39233) 2020-10-21 18:33:00 -07:00