spread vs unshift (v2)

Revision 2 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
push (append)
const arr1 = [0,1,2,3,4];
const arr2 = 5;
const arr3 = arr1.push(arr2);
ready
unshift (prepend)
const arr1 = [0,1,2,3,4];
const arr2 = 5;
const arr3 = arr1.unshift(arr2)
ready
spread (append)
const arr1 = [0,1,2,3,4];
const arr2 = 5;
const arr3 = [...arr1, arr2]
ready
spread (prepend)
const arr1 = [0,1,2,3,4];
const arr2 = 5;
const arr3 = [arr2, ...arr1]
ready

Revisions

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