aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2010-09-17 18:26:21 -0400
committerJohn Resig <jeresig@gmail.com>2010-09-17 18:26:21 -0400
commit7350e2e1cc671576804dab7cd82c739114146cb8 (patch)
treecda77d32f6ef1eba9a242ba77e9fcad1f0fb93da
parent2d70dc9c43831232a26dcdd01565df6c596ca977 (diff)
downloadjquery-7350e2e1cc671576804dab7cd82c739114146cb8.tar.gz
jquery-7350e2e1cc671576804dab7cd82c739114146cb8.zip
Added in some .css() setter perf tests as well.
-rw-r--r--speed/css.html37
1 files changed, 35 insertions, 2 deletions
diff --git a/speed/css.html b/speed/css.html
index e85575684..4d6700cf4 100644
--- a/speed/css.html
+++ b/speed/css.html
@@ -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");
@@ -40,10 +40,43 @@
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>