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(ivy): move attributes array into component def #32798

Closed
wants to merge 4 commits into from

Commits on Oct 8, 2019

  1. perf(ivy): move attributes array into component def

    Currently Ivy stores the element attributes into an array above the component def and passes it into the relevant instructions, however the problem is that upon minification the array will get a unique name which won't compress very well. These changes move the attributes array into the component def and pass in the index into the instructions instead.
    
    Before:
    ```
    const _c0 = ['foo', 'bar'];
    
    SomeComp.ngComponentDef = defineComponent({
      template: function() {
        element(0, 'div', _c0);
      }
    });
    ```
    
    After:
    ```
    SomeComp.ngComponentDef = defineComponent({
      consts: [['foo', 'bar']],
      template: function() {
        element(0, 'div', 0);
      }
    });
    ```
    
    A couple of cases that this PR doesn't handle:
    * Template references are still in a separate array.
    * i18n attributes are still in a separate array.
    crisbeto committed Oct 8, 2019
    Copy the full SHA
    c236616 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    a4510a9 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    73d111b View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    fb22a43 View commit details
    Browse the repository at this point in the history