]> source.dussan.org Git - jquery.git/commitdiff
Added in some .css() setter perf tests as well.
authorJohn Resig <jeresig@gmail.com>
Fri, 17 Sep 2010 22:26:21 +0000 (18:26 -0400)
committerJohn Resig <jeresig@gmail.com>
Fri, 17 Sep 2010 22:26:21 +0000 (18:26 -0400)
speed/css.html

index e855756846553d80ff42cb1560d233498d9959c3..4d6700cf486cc5003d7412ad8f15b9df7a6c7544 100644 (file)
@@ -7,7 +7,7 @@
        <script>var old = jQuery.noConflict(true);</script>
        <script src="../dist/jquery.js"></script>
        <script>
-       var events = [], num = 400, exec = false;
+       var num = 400;
 
        jQuery(function(){
                var p = old("p");
 
                jQuery("#num").text( old.fn.jquery + ": " + oldNum + " " + jQuery.fn.jquery + ": " + curNum );
        });
+
+       jQuery(function(){
+               var p = old("p");
+               var s = (new Date).getTime();
+
+               for ( var n = 0; n < 5; n++ ) {
+                       for ( var i = 0; i < num; i++ ) {
+                               p.css("position", "relative");
+                               p.css("top", 15);
+                               p.css("left", 15);
+                               p.css("display", "block");
+                       }
+               }
+
+               var oldNum = (new Date).getTime() - s;
+
+               p = jQuery("p");
+               s = (new Date).getTime();
+
+               for ( var n = 0; n < 5; n++ ) {
+                       for ( var i = 0; i < num; i++ ) {
+                               p.css("position", "relative");
+                               p.css("top", 15);
+                               p.css("left", 15);
+                               p.css("display", "block");
+                       }
+               }
+
+               var curNum = (new Date).getTime() - s;
+
+               jQuery("#num2").text( old.fn.jquery + ": " + oldNum + " " + jQuery.fn.jquery + ": " + curNum );
+       });
        </script>
        <style>p { position: absolute; top: 5px; left: 5px; }</style>
 </head>
 <body>
-       <p id="num">Hello there!</p>
+       <p><strong>Getting Values:</strong> <span id="num">Loading...</span></p>
+       <p><strong>Setting Values:</strong> <span id="num2">Loading...</span></p>
 </body>
 </html>