PerformanceTests/ChangeLog

 12012-01-30 Alexandru Chiculita <achicu@adobe.com>
 2
 3 Layout/floats.html should be runnable by run-perf-tests
 4 https://bugs.webkit.org/show_bug.cgi?id=77051
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 I've split Layout/floats.html into multiple tests for each button in the original manual test.
 9 Some tests take longer to run and I've changed the number of iterations, so that each tests finishes under 1s per run.
 10
 11 * DOM/resources/dom-perf.js:
 12 Moved Math.random to runner.js.
 13 * Layout/floats.html: Removed.
 14 * Layout/floats_100_100.html: Added.
 15 * Layout/floats_100_100_nested.html: Added.
 16 * Layout/floats_20_100.html: Added.
 17 * Layout/floats_20_100_nested.html: Added.
 18 * Layout/floats_2_100.html: Added.
 19 * Layout/floats_2_100_nested.html: Added.
 20 * Layout/floats_50_100.html: Added.
 21 * Layout/floats_50_100_nested.html: Added.
 22 * Layout/resources/floats.css: Added.
 23 (.container):
 24 (.float):
 25 (.big):
 26 (.float-end):
 27 * Layout/resources/floats.js: Added.
 28 Extracted the script from old floats.html.
 29 * Skipped:
 30 * resources/runner.js:
 31 (resetRandomSeed):
 32 (Math.random):
 33 Moved the Math.random to runner.js to be used by all tests.
 34 Added resetRandomSeed to bring the randomizer back to initial seed.
 35 It is useful to get the same results at every run and minimize the
 36 differences between runs.
 37
1382012-01-29 Ryosuke Niwa <rniwa@webkit.org>
239
340 DOM/DOMDivWalk.html result is unreliable

PerformanceTests/DOM/resources/dom-perf.js

@@function GetProfiler() {
115115 return new PseudoProfiler();
116116}
117117
118 // To make the benchmark results predictable, we replace Math.random with a
119 // 100% deterministic alternative.
120 Math.random = (function() {
121  var seed = 49734321;
122  return function() {
123  // Robert Jenkins' 32 bit integer hash function.
124  seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
125  seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
126  seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
127  seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff;
128  seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff;
129  seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff;
130  return (seed & 0xfffffff) / 0x10000000;
131  };
132 })();
133 
134118function Benchmark(name, run, opt_setup, opt_cleanup, opt_shareSetup) {
135119 this.name = name;
136120 this.timeToRun = 500; // ms

PerformanceTests/Layout/floats.html

1 <!DOCTYPE html>
2 <html>
3  <head>
4  <title>Floats layout performance tester</title>
5  <style>
6  .float {
7  float: left;
8  width: 5px;
9  height: 5px;
10  border: 1px solid green;
11  }
12  .big {
13  width: 10px;
14  }
15  .float-end {
16  clear:left;
17  }
18 
19  #framerate_panel {
20  display: none;
21  }
22  </style>
23  <script>
24  function createElement(tag, parent, className, id)
25  {
26  var el = document.createElement(tag);
27  el.className = className;
28  el.id = id;
29  parent.appendChild(el);
30  return el;
31  }
32 
33  function createSet(width, height, nested)
34  {
35  var container = createElement("div", document.body, "container");
36  for (var y = 0; y < height; ++y) {
37  for (var x = 0; x < width; ++x)
38  createElement("div", container, "float", "float" + x + "_" + y);
39 
40  var nestedContainer = container;
41  for ( ; nested > 0; --nested)
42  nestedContainer = createElement("div", nestedContainer, "nested", "nested" + x + "_" + nested);
43 
44  createElement("div", container, "float-end", "end" + x)
45  }
46  }
47 
48  function toggle(str, str1, str2)
49  {
50  if (str == str1)
51  return str2;
52  return str1;
53  }
54 
55  function test(width, height, nested)
56  {
57  nested = nested || 0;
58 
59  document.getElementById("test_panel").style.display = "none";
60  document.getElementById("framerate_panel").style.display = "block";
61 
62  createSet(width, height, nested);
63  var updates = 0;
64  var startTime = new Date();
65 
66  function updateTimer()
67  {
68  ++updates;
69 
70  var newTime = new Date();
71  var deltaTime = newTime - startTime;
72 
73  if ((deltaTime > 0 && updates > 100) || deltaTime > 1000) {
74  var fps = updates * 100 / deltaTime;
75  document.getElementById("fps").innerHTML = fps;
76  updates = 0;
77  startTime = newTime;
78  }
79  }
80 
81  function update()
82  {
83  var x = Math.floor(Math.random() * width);
84  var y = Math.floor(Math.random() * height);
85  var el = document.getElementById("float" + x + "_" + y);
86  el.className = toggle(el.className, "float", "float big");
87  updateTimer();
88  }
89  setInterval(update, 0);
90  }
91  </script>
92  </head>
93  <body>
94  <div id="framerate_panel">Framerate: <span id="fps">calculating...</span> fps</div>
95  <div id="test_panel">
96  <p>Choose the size of the test:</p>
97  <button onclick="test(2, 100)">2 by 100</button>
98  <button onclick="test(20, 100)">20 by 100</button>
99  <button onclick="test(50, 100)">50 by 100</button>
100  <button onclick="test(100, 100)">100 by 100</button>
101  <p>Nested divs:</p>
102  <button onclick="test(2, 100, 100)">2 by 100, 100 nested</button>
103  <button onclick="test(20, 100, 100)">20 by 100, 100 nested</button>
104  <button onclick="test(50, 100, 100)">50 by 100, 100 nested</button>
105  <button onclick="test(100, 100, 100)">100 by 100, 100 nested</button>
106  </div>
107  </body>
108 </html>

PerformanceTests/Layout/floats_100_100.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <title>Floats layout performance tester with 2 columns and 100 rows</title>
 5 <link rel="stylesheet" href="resources/floats.css" TYPE="text/css"></link>
 6 <script src="../resources/runner.js"></script>
 7 <script src="resources/floats.js"></script>
 8 </head>
 9 <body>
 10 <pre id="log"></pre>
 11 <script>
 12 start(10, createFloatsLayoutTestFunction(100, 100, 0, 5), 1);
 13 </script>
 14 </body>
 15</html>

PerformanceTests/Layout/floats_100_100_nested.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <title>Floats layout performance tester with 2 columns and 100 rows</title>
 5 <link rel="stylesheet" href="resources/floats.css" TYPE="text/css"></link>
 6 <script src="../resources/runner.js"></script>
 7 <script src="resources/floats.js"></script>
 8 </head>
 9 <body>
 10 <pre id="log"></pre>
 11 <script>
 12 start(10, createFloatsLayoutTestFunction(100, 100, 100, 5), 1);
 13 </script>
 14 </body>
 15</html>

PerformanceTests/Layout/floats_20_100.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <title>Floats layout performance tester with 2 columns and 100 rows</title>
 5 <link rel="stylesheet" href="resources/floats.css" TYPE="text/css"></link>
 6 <script src="../resources/runner.js"></script>
 7 <script src="resources/floats.js"></script>
 8 </head>
 9 <body>
 10 <pre id="log"></pre>
 11 <script>
 12 start(10, createFloatsLayoutTestFunction(20, 100, 0, 100), 1);
 13 </script>
 14 </body>
 15</html>

PerformanceTests/Layout/floats_20_100_nested.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <title>Floats layout performance tester with 2 columns and 100 rows</title>
 5 <link rel="stylesheet" href="resources/floats.css" TYPE="text/css"></link>
 6 <script src="../resources/runner.js"></script>
 7 <script src="resources/floats.js"></script>
 8 </head>
 9 <body>
 10 <pre id="log"></pre>
 11 <script>
 12 start(10, createFloatsLayoutTestFunction(20, 100, 100, 100), 1);
 13 </script>
 14 </body>
 15</html>

PerformanceTests/Layout/floats_2_100.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <title>Floats layout performance tester with 2 columns and 100 rows</title>
 5 <link rel="stylesheet" href="resources/floats.css" TYPE="text/css"></link>
 6 <script src="../resources/runner.js"></script>
 7 <script src="resources/floats.js"></script>
 8 </head>
 9 <body>
 10 <pre id="log"></pre>
 11 <script>
 12 start(10, createFloatsLayoutTestFunction(2, 100, 0, 500), 1);
 13 </script>
 14 </body>
 15</html>

PerformanceTests/Layout/floats_2_100_nested.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <title>Floats layout performance tester with 2 columns and 100 rows</title>
 5 <link rel="stylesheet" href="resources/floats.css" TYPE="text/css"></link>
 6 <script src="../resources/runner.js"></script>
 7 <script src="resources/floats.js"></script>
 8 </head>
 9 <body>
 10 <pre id="log"></pre>
 11 <script>
 12 start(10, createFloatsLayoutTestFunction(2, 100, 100, 500), 1);
 13 </script>
 14 </body>
 15</html>

PerformanceTests/Layout/floats_50_100.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <title>Floats layout performance tester with 2 columns and 100 rows</title>
 5 <link rel="stylesheet" href="resources/floats.css" TYPE="text/css"></link>
 6 <script src="../resources/runner.js"></script>
 7 <script src="resources/floats.js"></script>
 8 </head>
 9 <body>
 10 <pre id="log"></pre>
 11 <script>
 12 start(10, createFloatsLayoutTestFunction(50, 100, 0, 20), 1);
 13 </script>
 14 </body>
 15</html>

PerformanceTests/Layout/floats_50_100_nested.html

 1<!DOCTYPE html>
 2<html>
 3 <head>
 4 <title>Floats layout performance tester with 2 columns and 100 rows</title>
 5 <link rel="stylesheet" href="resources/floats.css" TYPE="text/css"></link>
 6 <script src="../resources/runner.js"></script>
 7 <script src="resources/floats.js"></script>
 8 </head>
 9 <body>
 10 <pre id="log"></pre>
 11 <script>
 12 start(10, createFloatsLayoutTestFunction(50, 100, 100, 20), 1);
 13 </script>
 14 </body>
 15</html>

PerformanceTests/Layout/resources/floats.css

 1.container {
 2 display: none;
 3}
 4
 5.float {
 6 float: left;
 7 width: 5px;
 8 height: 5px;
 9 border: 1px solid green;
 10}
 11
 12.big {
 13 width: 10px;
 14}
 15
 16.float-end {
 17 clear:left;
 18}

PerformanceTests/Layout/resources/floats.js

 1(function() {
 2 function createElement(tag, parent, className, id) {
 3 var el = document.createElement(tag);
 4 el.className = className;
 5 if (id)
 6 el.id = id;
 7 parent.appendChild(el);
 8 return el;
 9 }
 10
 11 function createSet(width, height, nested) {
 12 var container = createElement("div", document.body, "container");
 13 for (var y = 0; y < height; ++y) {
 14 for (var x = 0; x < width; ++x)
 15 createElement("div", container, "float", "float" + x + "_" + y);
 16
 17 var nestedContainer = container;
 18 for ( ; nested > 0; --nested)
 19 nestedContainer = createElement("div", nestedContainer, "nested", "nested" + x + "_" + nested);
 20
 21 createElement("div", container, "float-end", "end" + x)
 22 }
 23 return container;
 24 }
 25
 26 function toggle(str, str1, str2) {
 27 return str == str1 ? str2 : str1;
 28 }
 29
 30 function resetTest() {
 31 resetRandomSeed();
 32 var list = document.querySelectorAll(".float.big");
 33 for (var i = 0; i < list.length; ++i)
 34 list[i].className = "float";
 35 }
 36
 37 function createTestFunction(width, height, nested, runs) {
 38 var container = createSet(width, height, nested);
 39 nested = nested || 0;
 40 runs = runs || 10;
 41 return function() {
 42 container.style.display = "block";
 43 for (var i = 0; i < runs; ++i) {
 44 var x = Math.floor(Math.random() * width);
 45 var y = Math.floor(Math.random() * height);
 46 var el = document.getElementById("float" + x + "_" + y);
 47 el.className = toggle(el.className, "float", "float big");
 48 // Force a layout.
 49 container.clientHeight;
 50 }
 51 resetTest();
 52 container.style.display = "none";
 53 }
 54 }
 55
 56 window.createFloatsLayoutTestFunction = createTestFunction;
 57})();

PerformanceTests/Skipped

22Mutation
33
44# Do not conform to WebKit or Chromium perf test styles
5 Layout
65PageLoad
76SunSpider
87XSSAuditor

PerformanceTests/resources/runner.js

 1// To make the benchmark results predictable, we replace Math.random with a
 2// 100% deterministic alternative.
 3var initialRandomSeed = 49734321;
 4var randomSeed = initialRandomSeed;
 5
 6function resetRandomSeed() {
 7 randomSeed = initialRandomSeed
 8}
 9
 10Math.random = function() {
 11 // Robert Jenkins' 32 bit integer hash function.
 12 randomSeed = ((randomSeed + 0x7ed55d16) + (randomSeed << 12)) & 0xffffffff;
 13 randomSeed = ((randomSeed ^ 0xc761c23c) ^ (randomSeed >>> 19)) & 0xffffffff;
 14 randomSeed = ((randomSeed + 0x165667b1) + (randomSeed << 5)) & 0xffffffff;
 15 randomSeed = ((randomSeed + 0xd3a2646c) ^ (randomSeed << 9)) & 0xffffffff;
 16 randomSeed = ((randomSeed + 0xfd7046c5) + (randomSeed << 3)) & 0xffffffff;
 17 randomSeed = ((randomSeed ^ 0xb55a4f09) ^ (randomSeed >>> 16)) & 0xffffffff;
 18 return (randomSeed & 0xfffffff) / 0x10000000;
 19};
 20
 21
122function log(text) {
223 document.getElementById("log").innerHTML += text + "\n";
324 window.scrollTo(0, document.body.height);