chakra-core / chakra-core/ChakraCore

Create native arrays for bare Array() calls

Open
#2,082 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

Currently, when we handle "var x = new Array()", we allocate space for additional profile information on the array creation site. This allows us to do some optimizations and create native arrays, which are significantly faster in many cases. However, we can't currently do this for "var x = Array()". We had an attempt at doing this removed in https://github.com/Microsoft/ChakraCore/commit/db90b50c1bf606eef136274f19a9cf7fee2cd2ae, because it caused issues with the temporary register allocation in some situations (and likely produced incorrect code in some others). Doing this should win a good bit on minified code, as many minifiers remove the "new" from array creation sites to save 4 characters.

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.