chakra-core / chakra-core/ChakraCore

Spreading arrays is very slow compared to equivalent for-loop

Open
#4,642 4 comments 0 reactions 0 assignees View on GitHub
Performance
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Assuming `orig` is a standard gapless array with no custom behavior, the following:
```js
let dolly = [ ...orig ];
```

is approximately three times slower than

```js
let dolly = [];
for (let i = 0; i < orig.length; ++i) {
dolly[i] = orig[i];
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.