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
This commit is contained in:
Matias Niemelä 2019-04-09 14:08:05 -07:00 committed by Igor Minar
parent 3e4698564a
commit 675f3909d7
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}