Array unshift vs prepend vs concat (v30)

Revision 30 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Concat
a = [1, 2, 3, 4];
[0].concat(a);
ready
Prepend function
a = [1, 2, 3, 4];
a.unshift(0)
ready
Unshift without mutation
a = [1, 2, 3, 4];
a.slice(0).unshift(0);
ready
Push to unshift
a = [1, 2, 3, 4];
a.reverse().push(0);
a.reverse();
ready

Revisions

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