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 creating bound function in pipeBind3 #23882

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/render3/pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function pipeBind2(index: number, v1: any, v2: any): any {
*/
export function pipeBind3(index: number, v1: any, v2: any, v3: any): any {
const pipeInstance = load<PipeTransform>(index);
return isPure(index) ? pureFunction3(pipeInstance.transform.bind(pipeInstance), v1, v2, v3) :
return isPure(index) ? pureFunction3(pipeInstance.transform, v1, v2, v3, pipeInstance) :
pipeInstance.transform(v1, v2, v3);
}

Expand Down
12 changes: 11 additions & 1 deletion packages/core/src/render3/pure_function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {bindingUpdated, bindingUpdated2, bindingUpdated4, checkAndUpdateBinding,
* value. If it has been saved, returns the saved value.
*
* @param pureFn Function that returns a value
* @param thisArg Optional calling context of pureFn
* @returns value
*/
export function pureFunction0<T>(pureFn: () => T, thisArg?: any): T {
Expand All @@ -28,6 +29,7 @@ export function pureFunction0<T>(pureFn: () => T, thisArg?: any): T {
*
* @param pureFn Function that returns an updated value
* @param exp Updated expression value
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunction1(pureFn: (v: any) => any, exp: any, thisArg?: any): any {
Expand All @@ -43,6 +45,7 @@ export function pureFunction1(pureFn: (v: any) => any, exp: any, thisArg?: any):
* @param pureFn
* @param exp1
* @param exp2
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunction2(
Expand All @@ -60,6 +63,7 @@ export function pureFunction2(
* @param exp1
* @param exp2
* @param exp3
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunction3(
Expand All @@ -81,6 +85,7 @@ export function pureFunction3(
* @param exp2
* @param exp3
* @param exp4
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunction4(
Expand All @@ -102,6 +107,7 @@ export function pureFunction4(
* @param exp3
* @param exp4
* @param exp5
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunction5(
Expand All @@ -126,6 +132,7 @@ export function pureFunction5(
* @param exp4
* @param exp5
* @param exp6
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunction6(
Expand All @@ -151,6 +158,7 @@ export function pureFunction6(
* @param exp5
* @param exp6
* @param exp7
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunction7(
Expand Down Expand Up @@ -178,6 +186,7 @@ export function pureFunction7(
* @param exp6
* @param exp7
* @param exp8
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunction8(
Expand All @@ -200,7 +209,8 @@ export function pureFunction8(
*
* @param pureFn A pure function that takes binding values and builds an object or array
* containing those values.
* @param exp An array of binding values
* @param exps An array of binding values
* @param thisArg Optional calling context of pureFn
* @returns Updated value
*/
export function pureFunctionV(pureFn: (...v: any[]) => any, exps: any[], thisArg?: any): any {
Expand Down