adding element to the array start

JavaScript performance comparison

Test case created by avernikoz

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
array with spread
// # first case

const b = 'element'
const arr = new Array(1000).fill(undefined)

const c = [b, ...arr]
pending…
array with concat
// # second case

const b = 'element'
const arr = new Array(1000).fill(undefined)

const c = [b].concat(arr)
pending…
array with unshift
// # third case

const b = 'element'
const arr = new Array(1000).fill(undefined)

arr.unshift(b)
const c = arr.slice()
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments