Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <script src="../resources/runner.js"></script> | |
| 3 <div id="sample"></div> | |
| 4 <script> | |
| 5 const kCount = 10; | |
| 6 | |
| 7 const metaElements = (() => { | |
| 8 const result = []; | |
| 9 for (let count = 0; count < 100; ++count) | |
|
yoichio
2017/02/14 04:00:20
Amount of 100 <meta>s is O.K. to get better metric
| |
| 10 result.push('<meta>', '</meta>'); | |
| 11 return result; | |
| 12 })(); | |
| 13 const sample = document.getElementById('sample'); | |
| 14 sample.innerHTML = [ | |
| 15 '<div hiddent>', ...metaElements, '</div>', | |
| 16 '<h1 id="target">first line of renderered text</h1>', | |
| 17 '<div hiddent>', ...metaElements, '</div>', | |
| 18 ].join(''); | |
| 19 | |
| 20 const selection = window.getSelection(); | |
| 21 const target = document.getElementById('target'); | |
| 22 | |
| 23 PerfTestRunner.measureRunsPerSecond({ | |
| 24 description: 'Measures performance of move-down through non-renderered element s', | |
| 25 run: () => { | |
| 26 selection.collapse(target, 0); | |
| 27 selection.extend(target, target.childNodes.length); | |
| 28 for (let counter = 0; counter < kCount; ++counter) | |
| 29 selection.modify('move', 'forward', 'line'); | |
| 30 }, | |
| 31 }); | |
| 32 </script> | |
| 33 </body> | |
| OLD | NEW |