copy array slice-vs-concat (v4)

Revision 4 of this benchmark created on


Preparation HTML

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

Setup

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

Test runner

Ready to run.

Testing in
TestOps/sec
concat
var b = [].concat(a);
ready
json
var b = JSON.parse(JSON.stringify(a));
ready
slice
var b = a.slice(0);
ready
extend
var b = $.extend({}, a);
ready

Revisions

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