jQuery.each vs. for loop vs Ext.Array.each (v293)

Revision 293 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="http://cdn.sencha.io/ext-4.1.0-gpl/ext-all.js">
</script>
<script>
  $.fn.forEach = Array.prototype.forEach;
  var extArrayEach = Ext.each;
  var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.each
$.each(a, function(index, num) {
 num++;
});
ready
for loop
for (var i = 0, len = a.length; i < len; i++) {
 var num = a[i];
 num++;
};
ready
forEach
a.forEach(function(num, index){
 num++;
});
ready
Ext.Array.each
extArrayEach(a, function(num, index) {
 num++;
});
ready

Revisions

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