Skip to content

Commit ae1c0dc

Browse files
crisbetoalxhub
authored andcommitted
perf(compiler): chain query creation instructions
We always emit the query creation instructions in a group which makes them good candidates for chaining.
1 parent c9dfc6c commit ae1c0dc

20 files changed

Lines changed: 120 additions & 107 deletions

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/content_query_for_directive.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ ContentQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
33
selectors: [["content-query-component"]],
44
contentQueries: function ContentQueryComponent_ContentQueries(rf, ctx, dirIndex) {
55
if (rf & 1) {
6-
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, 5);
7-
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, 4);
6+
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, 5)(dirIndex, SomeDirective, 4);
87
}
98
if (rf & 2) {
10-
let $tmp$;
9+
let $tmp$;
1110
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDir = $tmp$.first);
1211
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDirList = $tmp$);
1312
}

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/content_query_for_local_ref.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ ContentQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
55
// ...
66
contentQueries: function ContentQueryComponent_ContentQueries(rf, ctx, dirIndex) {
77
if (rf & 1) {
8-
$r3$.ɵɵcontentQuery(dirIndex, $e0_attrs$, 5);
9-
$r3$.ɵɵcontentQuery(dirIndex, $e1_attrs$, 4);
8+
$r3$.ɵɵcontentQuery(dirIndex, $e0_attrs$, 5)(dirIndex, $e1_attrs$, 4);
109
}
1110
if (rf & 2) {
1211
let $tmp$;

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/content_query_forward_ref.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ ContentQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
33
selectors: [["content-query-component"]],
44
contentQueries: function ContentQueryComponent_ContentQueries(rf, ctx, dirIndex) {
55
if (rf & 1) {
6-
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, __QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__);
7-
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, __QueryFlags.emitDistinctChangesOnly__);
6+
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, __QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__)(dirIndex, SomeDirective, __QueryFlags.emitDistinctChangesOnly__);
87
}
98
if (rf & 2) {
109
let $tmp$;

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/content_query_read_token.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ ContentQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
55
// ...
66
contentQueries: function ContentQueryComponent_ContentQueries(rf, ctx, dirIndex) {
77
if (rf & 1) {
8-
$r3$.ɵɵcontentQuery(dirIndex, $e0_attrs$, 5, TemplateRef);
9-
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, 5, ElementRef);
10-
$r3$.ɵɵcontentQuery(dirIndex, $e1_attrs$, 4, ElementRef);
11-
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, 4, TemplateRef);
8+
$r3$.ɵɵcontentQuery(dirIndex, $e0_attrs$, 5, TemplateRef)(dirIndex, SomeDirective, 5, ElementRef)(dirIndex, $e1_attrs$, 4, ElementRef)(dirIndex, SomeDirective, 4, TemplateRef);
129
}
1310
if (rf & 2) {
14-
let $tmp$;
11+
let $tmp$;
1512
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRef = $tmp$.first);
1613
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.someDir = $tmp$.first);
1714
$r3$.ɵɵqueryRefresh($tmp$ = $r3$.ɵɵloadQuery()) && (ctx.myRefs = $tmp$);

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/query_with_emit_distinct_changes_only.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ ContentQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
44
// ...
55
contentQueries: function ContentQueryComponent_ContentQueries(rf, ctx, dirIndex) {
66
if (rf & 1) {
7-
$r3$.ɵɵcontentQuery(dirIndex, $e0_attrs$, __QueryFlags.emitDistinctChangesOnly__);
8-
$r3$.ɵɵcontentQuery(dirIndex, $e0_attrs$, __QueryFlags.none__);
7+
$r3$.ɵɵcontentQuery(dirIndex, $e0_attrs$, __QueryFlags.emitDistinctChangesOnly__)(dirIndex, $e0_attrs$, __QueryFlags.none__);
98
}
109
if (rf & 2) {
1110
let $tmp$;
@@ -16,8 +15,7 @@ ContentQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
1615
// ...
1716
viewQuery: function ContentQueryComponent_Query(rf, ctx) {
1817
if (rf & 1) {
19-
$r3$.ɵɵviewQuery(SomeDirective, __QueryFlags.emitDistinctChangesOnly__|__QueryFlags.descendants__);
20-
$r3$.ɵɵviewQuery(SomeDirective, __QueryFlags.descendants__);
18+
$r3$.ɵɵviewQuery(SomeDirective, __QueryFlags.emitDistinctChangesOnly__|__QueryFlags.descendants__)(SomeDirective, __QueryFlags.descendants__);
2119
}
2220
if (rf & 2) {
2321
let $tmp$;

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/static_content_query.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ ContentQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
33
selectors: [["content-query-component"]],
44
contentQueries: function ContentQueryComponent_ContentQueries(rf, ctx, dirIndex) {
55
if (rf & 1) {
6-
$r3$.ɵɵcontentQuery(
7-
dirIndex, SomeDirective, __QueryFlags.isStatic__|__QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__);
8-
$r3$.ɵɵcontentQuery(dirIndex, $ref0$, 5);
6+
$r3$.ɵɵcontentQuery(dirIndex, SomeDirective, __QueryFlags.isStatic__|__QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__)(dirIndex, $ref0$, 5);
97
}
108
if (rf & 2) {
119
let $tmp$;

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/static_view_query.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ ViewQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
55
selectors: [["view-query-component"]],
66
viewQuery: function ViewQueryComponent_Query(rf, ctx) {
77
if (rf & 1) {
8-
$r3$.ɵɵviewQuery(SomeDirective, __QueryFlags.isStatic__|__QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__);
9-
$r3$.ɵɵviewQuery($refs$, 5);
8+
$r3$.ɵɵviewQuery(SomeDirective, __QueryFlags.isStatic__|__QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__)($refs$, 5);
109
}
1110
if (rf & 2) {
1211
let $tmp$;

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/view_query_for_directive.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ ViewQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
33
selectors: [["view-query-component"]],
44
viewQuery: function ViewQueryComponent_Query(rf, ctx) {
55
if (rf & 1) {
6-
$r3$.ɵɵviewQuery(SomeDirective, 5);
7-
$r3$.ɵɵviewQuery(SomeDirective, 5);
6+
$r3$.ɵɵviewQuery(SomeDirective, 5)(SomeDirective, 5);
87
}
98
if (rf & 2) {
109
let $tmp$;

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/view_query_for_local_ref.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ ViewQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
55
// ...
66
viewQuery: function ViewQueryComponent_Query(rf, ctx) {
77
if (rf & 1) {
8-
$r3$.ɵɵviewQuery($e0_attrs$, 5);
9-
$r3$.ɵɵviewQuery($e1_attrs$, 5);
8+
$r3$.ɵɵviewQuery($e0_attrs$, 5)($e1_attrs$, 5);
109
}
1110
if (rf & 2) {
1211
let $tmp$;

packages/compiler-cli/test/compliance/test_cases/r3_compiler_compliance/components_and_directives/queries/view_query_forward_ref.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ ViewQueryComponent.ɵcmp = /*@__PURE__*/ $r3$.ɵɵdefineComponent({
33
selectors: [["view-query-component"]],
44
viewQuery: function ViewQueryComponent_Query(rf, ctx) {
55
if (rf & 1) {
6-
$r3$.ɵɵviewQuery(SomeDirective, __QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__);
7-
$r3$.ɵɵviewQuery(SomeDirective, __QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__);
6+
$r3$.ɵɵviewQuery(SomeDirective, __QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__)(SomeDirective, __QueryFlags.descendants__|__QueryFlags.emitDistinctChangesOnly__);
87
}
98
if (rf & 2) {
109
let $tmp$;

0 commit comments

Comments
 (0)