$.each vs. for loop in css.js

Benchmark created by Mike Sherov on


Description

proof of concept to not use jQuery $.each inside of other jQuery function for speed sake!

Preparation HTML

<script src="http://code.jquery.com/jquery-git.js"></script>
<script> git = jQuery.noConflict(); </script>

<script src="http://msherov.ayi.test.areyouinterested.com/js/jquery-10733.js"></script>
<script> patched = jQuery.noConflict(); </script>

<div id="widthdiv" style="width:10px;height:10px;margin:6px;border:6px;padding:3px;"></div>
<script>
   var input = {
      gitdiv: git( "#widthdiv" ),
      patcheddiv: patched( "#widthdiv")
   };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
$.each
input.gitdiv.outerWidth(true);
ready
for loop
input.patcheddiv.outerWidth(true);
ready

Revisions

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

  • Revision 1: published by Mike Sherov on