Browser Diet - jQuery.each vs. for loop (v71)

Revision 71 of this benchmark created on


Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
  var a = "Hello1",
  var b = "Hello2",
      e;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.each
$.each(a, function() { $.each(b, function() { e = this; }) })
ready
for loop
for (var i = 0, len = a.length; i < len; i++) { e = a[i]; }
ready
for without caching
for (var i = 0; i < a.length; i++) { for (var j = 0; j < b.length; j++) { e = a[i]; } }
ready
alternative for loop
for (var i in a) { for (var j in b) { e = a[i]; } }
ready
reverse for
for (var i = a.length; i--;) { for (var j = b.length; j--;) { e = a[i] } }
ready
while reverse
var i = a.length;
while(i){ e = a[--i] }
ready

Revisions

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