test_slam_layout, a new layout perf test case

This commit is contained in:
Patrick Walton 2013-06-03 21:49:58 -07:00
parent fb2ce2c00c
commit e6ff135c01
3 changed files with 31 additions and 0 deletions

View file

@ -0,0 +1,10 @@
#ohhi {
background-color: red;
padding: 6px;
}
#mark {
background-color: blue;
padding: 12px;
}

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="test_slam_layout.css">
</head>
<body><div id="ohhi"></div></body><script src="test_slam_layout.js"></script>
</html>

View file

@ -0,0 +1,14 @@
var divs = document.getElementsByTagName("div");
var div = divs[0];
var count = 1000;
var start = new Date();
for (var i = 0; i < count; i++) {
if (i % 2 == 0)
div.setAttribute('id', 'ohhi');
else
div.setAttribute('id', 'mark');
div.getBoundingClientRect();
}
var stop = new Date();
window.alert((stop - start) / count * 1e6 + " ns/layout");