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: AOT compilation optimizations (patch) #38843

Closed
wants to merge 2 commits into from

Commits on Sep 14, 2020

  1. perf(compiler-cli): only emit directive/pipe references that are used

    For the compilation of a component, the compiler has to prepare some
    information about the directives and pipes that are used in the template.
    This information includes an expression for directives/pipes, for usage
    within the compilation output. For large NgModule compilation scopes
    this has shown to introduce a performance hotspot, as the generation of
    expressions is quite expensive. This commit reduces the performance
    overhead by only generating expressions for the directives/pipes that
    are actually used within the template, significantly cutting down on
    the compiler's resolve phase.
    JoostK committed Sep 14, 2020
    Copy the full SHA
    182a909 View commit details
    Browse the repository at this point in the history
  2. perf(compiler-cli): optimize computation of type-check scope information

    When type-checking a component, the declaring NgModule scope is used
    to create a directive matcher that contains flattened directive metadata,
    i.e. the metadata of a directive and its base classes. This computation
    is done for all components, whereas the type-check scope is constant per
    NgModule. Additionally, the flattening of metadata is constant per
    directive instance so doesn't necessarily have to be recomputed for
    each component.
    
    This commit introduces a `TypeCheckScopes` class that is responsible
    for flattening directives and computing the scope per NgModule. It
    caches the computed results as appropriate to avoid repeated computation.
    JoostK committed Sep 14, 2020
    Copy the full SHA
    216a913 View commit details
    Browse the repository at this point in the history