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 local references into consts array #33129

Closed
wants to merge 1 commit into from

Conversation

crisbeto
Copy link
Member

Follow-up from #32798. Moves the local references array into the component def's consts in order to make it compress better.

Before:

const _c0 = ['foo', ''];

SomeComp.ngComponentDef = defineComponent({
  template: function() {
    element(0, 'div', null, _c0);
  }
});

After:

SomeComp.ngComponentDef = defineComponent({
  consts: [['foo', '']],
  template: function() {
    element(0, 'div', null, 0);
  }
});

@crisbeto crisbeto force-pushed the local-refs-in-def branch 3 times, most recently from e30a8b6 to 3adb337 Compare October 13, 2019 10:45
@crisbeto crisbeto added comp: ivy target: major This PR is targeted for the next major release labels Oct 13, 2019
@ngbot ngbot bot modified the milestone: needsTriage Oct 13, 2019
@crisbeto crisbeto added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 13, 2019
@crisbeto crisbeto marked this pull request as ready for review October 13, 2019 11:23
@crisbeto crisbeto requested review from a team as code owners October 13, 2019 11:23
@crisbeto
Copy link
Member Author

I ran some tests on the same app I tested #32798 against and there is a reduction in the gzipped size, but it's less than 1%. I'm guessing it's because template references just aren't as common as attributes.

packages/core/src/render3/instructions/container.ts Outdated Show resolved Hide resolved
packages/core/src/render3/definition.ts Outdated Show resolved Hide resolved
packages/core/src/render3/instructions/container.ts Outdated Show resolved Hide resolved
packages/core/src/render3/instructions/container.ts Outdated Show resolved Hide resolved
@kara kara added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 16, 2019
@crisbeto crisbeto force-pushed the local-refs-in-def branch 2 times, most recently from 6ed8a41 to bfef095 Compare October 16, 2019 20:13
Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kara kara added action: presubmit The PR is in need of a google3 presubmit and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Oct 16, 2019
@kara
Copy link
Contributor

kara commented Oct 16, 2019

VE presubmit

Ivy presubmit

@AndrewKushnir
Copy link
Contributor

New presubmits after rebasing:

@AndrewKushnir AndrewKushnir added target: patch This PR is targeted for the next patch release and removed target: major This PR is targeted for the next major release labels Oct 31, 2019
@AndrewKushnir
Copy link
Contributor

New presubmits (11/1):

@AndrewKushnir AndrewKushnir removed the action: presubmit The PR is in need of a google3 presubmit label Nov 2, 2019
@AndrewKushnir
Copy link
Contributor

FYI, VE and Ivy presubmits are successful.

@crisbeto feel free to add "merge" label if it's ready to be merged from your side and no additional approvals/reviews are required.

Thank you.

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Nov 2, 2019
Follow-up from angular#32798. Moves the local references array into the component def's `consts` in order to make it compress better.

Before:
```
const _c0 = ['foo', ''];

SomeComp.ngComponentDef = defineComponent({
  template: function() {
    element(0, 'div', null, _c0);
  }
});
```

After:
```
SomeComp.ngComponentDef = defineComponent({
  consts: [['foo', '']],
  template: function() {
    element(0, 'div', null, 0);
  }
});
```
@atscott atscott closed this in 66725b7 Nov 4, 2019
atscott pushed a commit that referenced this pull request Nov 4, 2019
Follow-up from #32798. Moves the local references array into the component def's `consts` in order to make it compress better.

Before:
```
const _c0 = ['foo', ''];

SomeComp.ngComponentDef = defineComponent({
  template: function() {
    element(0, 'div', null, _c0);
  }
});
```

After:
```
SomeComp.ngComponentDef = defineComponent({
  consts: [['foo', '']],
  template: function() {
    element(0, 'div', null, 0);
  }
});
```

PR Close #33129
mohaxspb pushed a commit to mohaxspb/angular that referenced this pull request Nov 7, 2019
Follow-up from angular#32798. Moves the local references array into the component def's `consts` in order to make it compress better.

Before:
```
const _c0 = ['foo', ''];

SomeComp.ngComponentDef = defineComponent({
  template: function() {
    element(0, 'div', null, _c0);
  }
});
```

After:
```
SomeComp.ngComponentDef = defineComponent({
  consts: [['foo', '']],
  template: function() {
    element(0, 'div', null, 0);
  }
});
```

PR Close angular#33129
mohaxspb pushed a commit to mohaxspb/angular that referenced this pull request Nov 7, 2019
Follow-up from angular#32798. Moves the local references array into the component def's `consts` in order to make it compress better.

Before:
```
const _c0 = ['foo', ''];

SomeComp.ngComponentDef = defineComponent({
  template: function() {
    element(0, 'div', null, _c0);
  }
});
```

After:
```
SomeComp.ngComponentDef = defineComponent({
  consts: [['foo', '']],
  template: function() {
    element(0, 'div', null, 0);
  }
});
```

PR Close angular#33129
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants