Length or cached length

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div></div>
<div id="foo">
  <span id="bar"></span>
</div>

Setup

var test = [1, 2, 34, 54, 23, 2, 5, 67, 8, 3];

Test runner

Ready to run.

Testing in
TestOps/sec
Length
for (var i = 0; i < test.length; i++) {
  // blah
}
ready
Cached
for (var i = 0, len = test.length; i < len; i++) {
  // blah
}
ready

Revisions

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