copy array slice-vs-concat (v6)

Revision 6 of this benchmark created on


Setup

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

Test runner

Ready to run.

Testing in
TestOps/sec
concat
b = a.concat();
ready
json
b = JSON.parse(JSON.stringify(a));
ready
slice
b = a.slice(0);
ready
concat new
b = e.concat(a);
ready
slice new
b = a.slice();
ready

Revisions

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