aboutsummaryrefslogtreecommitdiffstats
path: root/speed/css.html
blob: 4d6700cf486cc5003d7412ad8f15b9df7a6c7544 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!doctype html>
<html>
<head>
	<title>Test Event Handling Performance</title>
	<script src="benchmark.js"></script>
	<script src="jquery-basis.js"></script>
	<script>var old = jQuery.noConflict(true);</script>
	<script src="../dist/jquery.js"></script>
	<script>
	var num = 400;

	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");
				p.css("top");
				p.css("left");
				p.css("display");
			}
		}

		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");
				p.css("top");
				p.css("left");
				p.css("display");
			}
		}

		var curNum = (new Date).getTime() - s;

		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><strong>Getting Values:</strong> <span id="num">Loading...</span></p>
	<p><strong>Setting Values:</strong> <span id="num2">Loading...</span></p>
</body>
</html>