Title: [92444] trunk/PerformanceTests
- Revision
- 92444
- Author
- [email protected]
- Date
- 2011-08-04 21:51:00 -0700 (Thu, 04 Aug 2011)
Log Message
Add a performance test for floating elements layout algorithm
https://bugs.webkit.org/show_bug.cgi?id=65741
The test creating lots of small floats and randomly changes
the width of one element at a time. It measures how often it can do that.
Patch by Alexandru Chiculita <[email protected]> on 2011-08-04
Reviewed by Adam Barth.
* Layout/floats.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/PerformanceTests/ChangeLog (92443 => 92444)
--- trunk/PerformanceTests/ChangeLog 2011-08-05 03:50:17 UTC (rev 92443)
+++ trunk/PerformanceTests/ChangeLog 2011-08-05 04:51:00 UTC (rev 92444)
@@ -1,3 +1,15 @@
+2011-08-04 Alexandru Chiculita <[email protected]>
+
+ Add a performance test for floating elements layout algorithm
+ https://bugs.webkit.org/show_bug.cgi?id=65741
+
+ The test creating lots of small floats and randomly changes
+ the width of one element at a time. It measures how often it can do that.
+
+ Reviewed by Adam Barth.
+
+ * Layout/floats.html: Added.
+
2011-05-30 Daniel Bates <[email protected]>
Reviewed by Adam Barth.
Added: trunk/PerformanceTests/Layout/floats.html (0 => 92444)
--- trunk/PerformanceTests/Layout/floats.html (rev 0)
+++ trunk/PerformanceTests/Layout/floats.html 2011-08-05 04:51:00 UTC (rev 92444)
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Floats layout performance tester</title>
+ <style>
+ .float {
+ float: left;
+ width: 5px;
+ height: 5px;
+ border: 1px solid green;
+ }
+ .big {
+ width: 10px;
+ }
+ .float-end {
+ clear:left;
+ }
+
+ #framerate_panel {
+ display: none;
+ }
+ </style>
+ <script>
+ function createElement(tag, parent, className, id)
+ {
+ var el = document.createElement(tag);
+ el.className = className;
+ el.id = id;
+ parent.appendChild(el);
+ return el;
+ }
+
+ function createSet(width, height)
+ {
+ var container = createElement("div", document.body, "container");
+ for (var y = 0; y < height; ++y) {
+ for (var x = 0; x < width; ++x)
+ createElement("div", container, "float", "float" + x + "_" + y);
+ createElement("div", container, "float-end", "end" + x)
+ }
+ }
+
+ function toggle(str, str1, str2)
+ {
+ if (str == str1)
+ return str2;
+ return str1;
+ }
+
+ function test(width, height)
+ {
+ document.getElementById("test_panel").style.display = "none";
+ document.getElementById("framerate_panel").style.display = "block";
+
+ createSet(width, height);
+ var updates = 0;
+ var startTime = new Date();
+
+ function updateTimer()
+ {
+ ++updates;
+
+ var newTime = new Date();
+ var deltaTime = newTime - startTime;
+
+ if ((deltaTime > 0 && updates > 100) || deltaTime > 1000) {
+ var fps = updates * 100 / deltaTime;
+ document.getElementById("fps").innerHTML = fps;
+ updates = 0;
+ startTime = newTime;
+ }
+ }
+
+ function update()
+ {
+ var x = Math.floor(Math.random() * width);
+ var y = Math.floor(Math.random() * height);
+ var el = document.getElementById("float" + x + "_" + y);
+ el.className = toggle(el.className, "float", "float big");
+ updateTimer();
+ }
+ setInterval(update, 0);
+ }
+ </script>
+ </head>
+ <body>
+ <div id="framerate_panel">Framerate: <span id="fps">calculating...</span> fps</div>
+ <div id="test_panel">
+ <p>Choose the size of the test:</p>
+ <button _onclick_="test(2, 100)">2 by 100</button>
+ <button _onclick_="test(20, 100)">20 by 100</button>
+ <button _onclick_="test(50, 100)">50 by 100</button>
+ <button _onclick_="test(100, 100)">100 by 100</button>
+ </div>
+ </body>
+</html>
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes