Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(core): avoid storing LView in __ngContext__ #41358

Closed
wants to merge 9 commits into from

Commits on Apr 22, 2021

  1. perf(core): avoid storing LView in __ngContext__

    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 angular#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 angular#41047.
    crisbeto committed Apr 22, 2021
    Copy the full SHA
    9d630a8 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    bb5e9de View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    6b07f29 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    1420322 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    af284dd View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    ee99582 View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    1fa1ae7 View commit details
    Browse the repository at this point in the history
  8. Copy the full SHA
    39abf88 View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2021

  1. Copy the full SHA
    d906995 View commit details
    Browse the repository at this point in the history