Skip to content

Performance regression in __spreadArray Β #44287

Closed
@FlorianDr

Description

@FlorianDr

Bug Report

πŸ”Ž Search Terms

__spreadArray performance benchmarking

πŸ•— Version & Regression Information

  • This changed between versions 4.1 and 4.2

⏯ Playground Link

CodeSandbox with benchmarks
Playground link with configuration example

πŸ’» Code

__spreadArray(__spreadArray([], arr1), arr2)
// vs.
__spreadArrays(arr1, arr2)

πŸ™ Actual behavior

Starting from 4.2, occurences of __spreadArrays are replaced with multiple calls to __spreadArray. The change fixes side effects in the polyfill (#32959).

Function Browser Arrays Elements per Array Runs Mean time in ms Slowdown
__spreadArrays Chromium 90 1 (numbers) 1000000 100 2.32
__spreadArray Chromium 90 1 (numbers) 1000000 100 10.29 4.43
__spreadArrays Chromium 90 2 (numbers) 1000000 100 4.35
__spreadArray Chromium 90 2 (numbers) 1000000 100 25.4 5.83
__spreadArrays Chromium 90 2 (objects) 1000000 100 4.82
__spreadArray Chromium 90 2 (objects) 1000000 100 68.1 14.10

πŸ™‚ Expected behavior

No or moderate performance impact.

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions