-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
refactor(core): Replace ExpandoInstructions
with HostBindingOpCodes
#39301
Conversation
5380eee
to
2f7bb31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just left a few minor comments, thanks @mhevery 👍
@@ -409,11 +409,17 @@ export interface TNode { | |||
|
|||
/** | |||
* Stores starting index of the directives. | |||
* | |||
* The first directive is always component. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an important comment, thanks for adding it! 👍
Can we expand it a bit by adding a reference to the corresponding function/logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you suggest what you would like to see here.
eefd762
to
edc7b59
Compare
* for (let i = 0; i < hostBindingOpCodes.length; i++) { | ||
* const opCode = hostBindingOpCodes[i] as number; | ||
* if (opCode < 0) { | ||
* // Negative numbers are element indexes. | ||
* setSelectedIndex(~opCode); | ||
* } else { | ||
* // Positive numbers are NumberTuple which store bindingRootIndex and directiveIndex. | ||
* const directiveIdx = opCode; | ||
* const bindingRootIndx = hostBindingOpCodes[++i] as number; | ||
* const hostBindingFn = hostBindingOpCodes[++i] as HostBindingsFunction<any>; | ||
* setBindingRootForHostBindings(bindingRootIndx, directiveIdx); | ||
* const context = lView[directiveIdx]; | ||
* hostBindingFn(RenderFlags.Update, context); | ||
* } | ||
* } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT - you can dedent these lines, since the if
statement above does not create a block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, this pseudo code indicates that the items after the elementIdx
can be 0 or more, rather than the 1 or more mentioned further up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dedented.
I see your point about 1 or more vs 0 or more. But in practice it would be 1 or more, even thought you are right the code supports it. I don't want to suggest that there would ever be situation followed by 0 functions. That would be just wasteful. Any suggestion on how to make that more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: size-tracking
d51b241
to
41d1b35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with just a few minor comments. This technique to optionally pull in part of the core is interesting (but admittedly it makes my head hurt a bit).
Thanks for tracking down most of the size regression and documenting the debugging steps.
Reviewed-for: global-approvers, size-tracking
41d1b35
to
d2e3728
Compare
d2e3728
to
872af70
Compare
872af70
to
993c487
Compare
993c487
to
214459a
Compare
214459a
to
feeac7a
Compare
The `ExpandoInstructions` was unnecessarily convoluted way to solve the problem of calling the `HostBindingFunction`s on components and directives. The code was complicated and hard to fallow. The replacement is a simplified way to achieve the same thing, which is also more efficient in space and speed.
feeac7a
to
96a513a
Compare
`TNode.insertBeforeIndex` is only populated when i18n is present. This change puts all code which reads `insertBeforeIndex` behind a dynamically loaded functions which are set only when i18n code executes.
96a513a
to
af78a0f
Compare
`TNode.insertBeforeIndex` is only populated when i18n is present. This change puts all code which reads `insertBeforeIndex` behind a dynamically loaded functions which are set only when i18n code executes. PR Close #39301
…s` (#39301) The `ExpandoInstructions` was unnecessarily convoluted way to solve the problem of calling the `HostBindingFunction`s on components and directives. The code was complicated and hard to fallow. The replacement is a simplified way to achieve the same thing, which is also more efficient in space and speed. PR Close #39301
`TNode.insertBeforeIndex` is only populated when i18n is present. This change puts all code which reads `insertBeforeIndex` behind a dynamically loaded functions which are set only when i18n code executes. PR Close #39301
This commit removes a workaround to calculate the `expandoStartIndex` value. That workaround was needed because the `expandoStartIndex` was updated previously, so it pointed at the wrong location. The PR angular#39301 (angular#39301) fixed that problem and the workaround is no longer needed.
This commit removes a workaround to calculate the `expandoStartIndex` value. That workaround was needed because the `expandoStartIndex` was updated previously, so it pointed at the wrong location. The problem was fixed in PR angular#39301 and the workaround is no longer needed.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Review last change only.
This PR builds on #39233 and #39003
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information