perf(ivy): avoid storing raw selectors in projectionDef (#29578)
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 #29578
This commit is contained in:

committed by
Igor Minar

parent
f98093a30d
commit
def73a6728
@ -1360,18 +1360,22 @@ function generateInitialInputs(
|
||||
// We do not allow inputs on namespaced attributes.
|
||||
i += 4;
|
||||
continue;
|
||||
} else if (attrName === AttributeMarker.ProjectAs) {
|
||||
// Skip over the `ngProjectAs` value.
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we hit any other attribute markers, we're done anyway. None of those are valid inputs.
|
||||
if (typeof attrName === 'number') break;
|
||||
|
||||
const minifiedInputName = inputs[attrName];
|
||||
const minifiedInputName = inputs[attrName as string];
|
||||
const attrValue = attrs[i + 1];
|
||||
|
||||
if (minifiedInputName !== undefined) {
|
||||
const inputsToStore: InitialInputs =
|
||||
initialInputData[directiveIndex] || (initialInputData[directiveIndex] = []);
|
||||
inputsToStore.push(attrName, minifiedInputName, attrValue as string);
|
||||
inputsToStore.push(attrName as string, minifiedInputName, attrValue as string);
|
||||
}
|
||||
|
||||
i += 2;
|
||||
|
Reference in New Issue
Block a user