| OLD | NEW | 
|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> | 
| 2 <html> | 2 <html> | 
| 3 <body> | 3 <body> | 
| 4 <script src="../resources/runner.js"></script> | 4 <script src="../resources/runner.js"></script> | 
| 5 <script> | 5 <script> | 
| 6 function buildTree() | 6 function buildTree() | 
| 7 { | 7 { | 
| 8     wrapper = document.createElement("div"); | 8     wrapper = document.createElement("div"); | 
| 9     for (i = 0; i < 1000; ++i) { | 9     for (i = 0; i < 1000; ++i) { | 
| 10         var child = document.createElement("div"); | 10         var child = document.createElement("div"); | 
| 11         for (j = 0; j < 1000; ++j) { | 11         for (j = 0; j < 1000; ++j) { | 
| 12             var grandChild = document.createElement("div"); | 12             var grandChild = document.createElement("div"); | 
| 13             child.appendChild(grandChild); | 13             child.appendChild(grandChild); | 
| 14         } | 14         } | 
| 15         wrapper.appendChild(child); | 15         wrapper.appendChild(child); | 
| 16     } | 16     } | 
| 17     document.body.appendChild(wrapper); | 17     document.body.appendChild(wrapper); | 
| 18 } | 18 } | 
| 19 | 19 | 
| 20 function setup() { | 20 function setup() { | 
| 21     wrapper.style.display = "block"; | 21     wrapper.style.display = "block"; | 
| 22     // Force a layout so that everything is up-to-date. | 22     PerfTestRunner.forceLayout(); | 
| 23     wrapper.offsetTop; |  | 
| 24 } | 23 } | 
| 25 | 24 | 
| 26 function runTest() { | 25 function runTest() { | 
| 27     setup(); | 26     setup(); | 
| 28 | 27 | 
| 29     var now = PerfTestRunner.now(); | 28     var now = PerfTestRunner.now(); | 
| 30 | 29 | 
| 31     wrapper.style.display = "none"; | 30     wrapper.style.display = "none"; | 
| 32     wrapper.offsetTop; | 31     PerfTestRunner.forceLayout(); | 
| 33 | 32 | 
| 34     return PerfTestRunner.now() - now; | 33     return PerfTestRunner.now() - now; | 
| 35 } | 34 } | 
| 36 | 35 | 
| 37 buildTree(); | 36 buildTree(); | 
| 38 | 37 | 
| 39 PerfTestRunner.measureTime({run: runTest, description: "This benchmark checks th
    e time spend in detaching an tree." }); | 38 PerfTestRunner.measureTime({run: runTest, description: "This benchmark checks th
    e time spend in detaching an tree." }); | 
| 40 </script> | 39 </script> | 
| 41 </body> | 40 </body> | 
| 42 </html> | 41 </html> | 
| OLD | NEW | 
|---|