array.length idiotism

Benchmark created by Yuriy on


Description

Idiotism in the test system

Preparation HTML

<script>
 var arr = [],
     b;
 while (arr.length < 1000000) {
  a[a.length] = a.length;
 };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
No caching
for (var i = 0; i < arr.length; i++) {
 b = b + arr[i];
};
ready
Caching
for (var i = 0; i < arr.length; i++) {
 b = b + arr[i];
};
ready
Reverse while
var l = arr.length;
while (l--) {
 b = b + arr[l];
};
ready

Revisions

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

  • Revision 1: published by Yuriy on