copy array slice-vs-concat (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
slice
var a = [];
for (var i = 0; i < 10000; i++) a.push('550e8400-e29b-41d4-a716-446655440000');

var b = [];
for (var j = 0; j < 100000; j++) b = a.slice(0);
ready
concat
var a = [];
for (var i = 0; i < 10000; i++) a.push('550e8400-e29b-41d4-a716-446655440000');

var b = [];
for (var j = 0; j < 100000; j++) b = [].concat(a);
ready
jquery
var a = [];
for (var i = 0; i < 10000; i++) a.push('550e8400-e29b-41d4-a716-446655440000');

var b = [];
for (var j = 0; j < 100000; j++) b = $.extend({}, a);
ready

Revisions

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