Underscore.each vs jQuery.each vs. for loop vs. nimble-foreach (v90)

Revision 90 of this benchmark created on


Preparation HTML

<script src="//documentcloud.github.com/underscore/underscore-min.js">
</script>
<script src="https://raw.github.com/chrisevans/nimble/master/nimble.js"></script>
<script src="http://zeptojs.com/zepto.min.js"></script>
<script>
  var pi = Math.PI
  var a = "t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t".split(","),
      e;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
zepto.each
$.each(a, function(index, val) {
  val = pi;
});
ready
good old for loop
for (var i = 0, len = a.length; i < len; i++) {
  e = pi;
};
ready
underscore.each
_.each(a, function(item) {
  item = pi;
});
ready
nimble.each
nimble.each(a, function(val) {
  val = pi;
});
ready

Revisions

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