for vs for-in

Benchmark created on


Description

for-vs-for-in

Preparation HTML

<script>
  var a = [];
  
  for (j = 0; j < 10000; j++) {
   a.push(j);
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
for
var i, t;
for (i = 0; i < a.length; i++) {
 t = a[i];
}
ready
for-lengh
var i, t, l = a.length;
for (i = 0; i < l; i++) {
 t = a[i];
}
ready
for-in
var t, i;
for (i in a) {
 t = a[i];
}
ready

Revisions

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