for loop length cache (v5)

Revision 5 of this benchmark created by Kyle Simpson on


Preparation HTML

<script>
  var arr = new Array(10000),
      len = arr.length;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
no cache
for (var i = 0; i < arr.length; i++) {
 var a = arr[i];
}
ready
cache length
for (var i = 0; i < len; i++) {
 var a = arr[i];
}
ready

Revisions

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

  • Revision 1: published by miller on
  • Revision 5: published by Kyle Simpson on