New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 882784 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Sep 13
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Array.slice() is up to 40% slower than Array.slice(0)

Reported by fischer...@gmail.com, Sep 11

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36

Steps to reproduce the problem:
Just visit jsPerf test

or run this code:

array = [];
for (i = 0; i < 999; i++) array.push(i);
times = [];
time = performance.now();
for (i = 0; i < 9999; i++) array.slice();
times.push(performance.now() - time);
time = performance.now();
for (i = 0; i < 9999; i++) array.slice(0);
times.push(performance.now() - time);
console.log('slice( ): %d\nslice(0): %d', times[0], times[1]);

What is the expected behavior?
The execution time of slice() and slice(0) should be similar

What went wrong?
slice() is around 40% slower than slice(0)

Did this work before? N/A 

Chrome version: 69.0.3497.81  Channel: stable
OS Version: OS X 10.13.6
Flash Version:
 

Comment 1 Deleted

Comment 2 Deleted

The link for the mentioned jsPerf test: https://jsperf.com/cloning-arrays/3

According to the stats on the jsPerf test page it seems the regression occurred with Chrome version 64 where the performance of slice(0) was improved but slice() not.
Labels: Needs-Triage-M69
Components: -Blink Blink>JavaScript
Array@slice was optimized in Chrome 70 ( bug v8:7980 ).
You can test it in Chrome Canary or beta or dev channel.
Cc: dhai@google.com neis@chromium.org ajha@chromium.org
Thanks  woxxom@ for pointing that out. Cc'ing neis@/dhai@ from ( bug v8:7980 ) for inputs. 

  
Status: Fixed (was: Unconfirmed)
Yes, they are on par now.

Sign in to add a comment