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): avoid storing raw selectors in projectionDef #29578

Closed
wants to merge 2 commits into from

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Mar 28, 2019

Currently in Ivy we pass both the raw and parsed selectors to the projectionDef instruction, because the parsed selectors are used to match most nodes, whereas the raw ones are used to match against nodes with the ngProjectAs attribute. The raw selectors add a fair bit of code that won't be used in most cases, because ngProjectAs is somewhat rare.

These changes rework the compiler not to output the raw selectors in the projectionDef, but to parse the selector in ngProjectAs and to store it on the TAttributes. The logic for matching has also been changed so that it matches the pre-parsed ngProjectAs selector against the list of projection selectors.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer comp: ivy labels Mar 28, 2019
@ngbot ngbot bot added this to the needsTriage milestone Mar 28, 2019
@crisbeto crisbeto marked this pull request as ready for review March 28, 2019 22:52
@crisbeto crisbeto requested review from a team as code owners March 28, 2019 22:52
Copy link
Member

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

I wonder if we should make ngProjectAs attributes special, in the sense that we create a new AttributeMarker.ngProjectAs flag. This would mean that our processing of "normal" attributes is not affected and fast as possible, which is the most common case.

@crisbeto
Copy link
Member Author

Introducing a flag would definitely make it more consistent, but I'm not sure whether it would help with processing since the TAttributes is still a (string | number | CssSelector)[] when we're iterating over it.

Copy link
Contributor

@mhevery mhevery left a comment

Choose a reason for hiding this comment

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

I am concerned about the changes we have made to the generateInitialInputs Could we discuss?

packages/core/src/render3/instructions/instructions.ts Outdated Show resolved Hide resolved
@crisbeto crisbeto force-pushed the FW-955/ng-project-as branch 6 times, most recently from c1a6635 to e974d32 Compare April 4, 2019 19:44
@crisbeto
Copy link
Member Author

crisbeto commented Apr 4, 2019

I've reworked it to use a marker for ngProjectAs.

Copy link
Member

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

It would be good to see some tests that exercise the code with projectAs using classes and not too. Currently there only appears to be attribute based selectors. But I might have missed them.

@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 target: major This PR is targeted for the next major release and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 8, 2019
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer 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 Apr 8, 2019
@crisbeto
Copy link
Member Author

crisbeto commented Apr 8, 2019

Rebased and addressed the feedback @kara.

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 requested a review from mhevery April 9, 2019 17:15
@mhevery mhevery added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 9, 2019
@mhevery
Copy link
Contributor

mhevery commented Apr 9, 2019

@kara kara added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Apr 9, 2019
@kara
Copy link
Contributor

kara commented Apr 9, 2019

merge assistance: global approval

@IgorMinar IgorMinar added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Apr 10, 2019
@IgorMinar
Copy link
Contributor

@crisbeto this PR now has a big conflict. can you please resolve it? thank you!

Currently in Ivy we pass both the raw and parsed selectors to the projectionDef instruction, because the parsed selectors are used to match most nodes, whereas the raw ones are used to match against nodes with the ngProjectAs attribute. The raw selectors add a fair bit of code that won't be used in most cases, because ngProjectAs is somewhat rare.

These changes rework the compiler not to output the raw selectors in the projectionDef, but to parse the selector in ngProjectAs and to store it on the TAttributes. The logic for matching has also been changed so that it matches the pre-parsed ngProjectAs selector against the list of projection selectors.
@crisbeto crisbeto force-pushed the FW-955/ng-project-as branch 2 times, most recently from 43a90d0 to c59c34e Compare April 10, 2019 19:55
@crisbeto crisbeto requested a review from a team as a code owner April 10, 2019 20:07
@crisbeto crisbeto removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Apr 10, 2019
@crisbeto
Copy link
Member Author

Conflicts have been resolved.

@IgorMinar
Copy link
Contributor

@crisbeto thank you! ❤️

@IgorMinar IgorMinar closed this in def73a6 Apr 11, 2019
wKoza pushed a commit to wKoza/angular that referenced this pull request Apr 17, 2019
Currently in Ivy we pass both the raw and parsed selectors to the projectionDef instruction, because the parsed selectors are used to match most nodes, whereas the raw ones are used to match against nodes with the ngProjectAs attribute. The raw selectors add a fair bit of code that won't be used in most cases, because ngProjectAs is somewhat rare.

These changes rework the compiler not to output the raw selectors in the projectionDef, but to parse the selector in ngProjectAs and to store it on the TAttributes. The logic for matching has also been changed so that it matches the pre-parsed ngProjectAs selector against the list of projection selectors.

PR Close angular#29578
@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 Sep 14, 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 merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants