From 675f3909d75efda68c529d62f2faac99af166760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Tue, 9 Apr 2019 14:08:05 -0700 Subject: [PATCH] perf(ivy): do not use spread operations in styling (#29795) While investigating styling performance regressions, it was discovered that a single `fn(...args)` operation was causing a performance hit because the generated es5 `__spread` operation uses `[].concat` and reads from the `arguments` values (which are not very efficient). This patch changes that around to use `fn.apply` instead. PR Close #29795 --- packages/core/src/render3/styling/host_instructions_queue.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/render3/styling/host_instructions_queue.ts b/packages/core/src/render3/styling/host_instructions_queue.ts index 07d01cd94a..a691397fb4 100644 --- a/packages/core/src/render3/styling/host_instructions_queue.ts +++ b/packages/core/src/render3/styling/host_instructions_queue.ts @@ -65,7 +65,7 @@ export function flushQueue(context: StylingContext): void { i += HostInstructionsQueueIndex.Size) { const fn = buffer[i + HostInstructionsQueueIndex.InstructionFnOffset] as Function; const args = buffer[i + HostInstructionsQueueIndex.ParamsOffset] as any[]; - fn(...args); + fn.apply(this, args); } buffer.length = HostInstructionsQueueIndex.ValuesStartPosition; }