mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
test_slam_layout, a new layout perf test case
This commit is contained in:
parent
fb2ce2c00c
commit
e6ff135c01
3 changed files with 31 additions and 0 deletions
10
src/test/html/test_slam_layout.css
Normal file
10
src/test/html/test_slam_layout.css
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ohhi {
|
||||
background-color: red;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
#mark {
|
||||
background-color: blue;
|
||||
padding: 12px;
|
||||
}
|
||||
|
7
src/test/html/test_slam_layout.html
Normal file
7
src/test/html/test_slam_layout.html
Normal 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>
|
14
src/test/html/test_slam_layout.js
Normal file
14
src/test/html/test_slam_layout.js
Normal 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");
|
Loading…
Add table
Add a link
Reference in a new issue