perf(ivy): chain multiple property instructions (#31078)
Currently each property binding generates an instruction like this: ``` property('prop1', ctx.value1); property('prop2', ctx.value2); ``` The problem is that we're repeating the call to `property` for each of the properties. Since the `property` instruction returns itself, we can chain all of the calls which is more compact and it looks like this: ``` property('prop1', ctx.value1)('prop2', ctx.value2); ``` These changes implement the chaining behavior for regular property bindings and for synthetic ones, however interpolated ones are still handled like before, because they use a separate instruction. This PR resolves FW-1389. PR Close #31078
This commit is contained in:
@ -361,7 +361,6 @@ describe('compiler compliance', () => {
|
||||
// `$r3$.ɵɵproperty("ternary", (ctx.cond ? $r3$.ɵɵpureFunction1(8, $c0$, ctx.a): $c1$));`
|
||||
///////////////
|
||||
|
||||
const $e0_attrs$ = [];
|
||||
const factory =
|
||||
'factory: function MyComponent_Factory(t) { return new (t || MyComponent)(); }';
|
||||
const template = `
|
||||
@ -371,10 +370,7 @@ describe('compiler compliance', () => {
|
||||
$r3$.ɵɵpipe(1,"pipe");
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵɵproperty("ternary", ctx.cond ? $r3$.ɵɵpureFunction1(8, $c0$, ctx.a): $c1$);
|
||||
$r3$.ɵɵproperty("pipe", $r3$.ɵɵpipeBind3(1, 4, ctx.value, 1, 2));
|
||||
$r3$.ɵɵproperty("and", ctx.cond && $r3$.ɵɵpureFunction1(10, $c0$, ctx.b));
|
||||
$r3$.ɵɵproperty("or", ctx.cond || $r3$.ɵɵpureFunction1(12, $c0$, ctx.c));
|
||||
$r3$.ɵɵproperty("ternary", ctx.cond ? $r3$.ɵɵpureFunction1(8, $c0$, ctx.a): $c1$)("pipe", $r3$.ɵɵpipeBind3(1, 4, ctx.value, 1, 2))("and", ctx.cond && $r3$.ɵɵpureFunction1(10, $c0$, ctx.b))("or", ctx.cond || $r3$.ɵɵpureFunction1(12, $c0$, ctx.c));
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
Reference in New Issue
Block a user