array-copy

Benchmark created by Felipe N Moura on


Setup

a= [];
  for(var i= 0; i<10000; i++){
      a.push(i);
  }
  b= null;

Test runner

Ready to run.

Testing in
TestOps/sec
slicing
b= a.slice(0);
ready
join and split
b= a.join('@@@').split('@@@');
ready
forEach
b= [];
a.forEach(function(cur){
    b.push(cur);
});
ready
for in
b= [];
for(var cur in a){
    b.push(a[cur]);
}
ready
concat
b= a.concat();
ready

Revisions

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

  • Revision 1: published by Felipe N Moura on
  • Revision 2: published by Daniel Martins on
  • Revision 3: published by Eduardo Bohrer on
  • Revision 4: published by Felipe N. Moura on
  • Revision 5: published on
  • Revision 6: published by massic80 on
  • Revision 7: published by Felipe N Moura on
  • Revision 8: published on
  • Revision 9: published on