localglobal

Benchmark created on


Preparation HTML

<script>
  arr = [];
  for (var i = 100; i-- > 0;)
  arr.push('test ' + i);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Copy to local
var arr2 = [],
    localArr = arr.slice(); // slice to copy
for (var i = 100; --i > 0;) {
 arr2.push(localArr[i]);
}
ready
Use global
var arr2 = [];
for (var i = 100; --i > 0;) {
 arr2.push(arr[i]);
}
ready

Revisions

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