| <script src="../resources/runner.js"></script> |
| <div id="sandbox" style="display:none"></div> |
| var sandbox = document.getElementById('sandbox'); |
| for (var i = 0; i < 200; ++i) |
| node = node.appendChild(document.createElement('div')); |
| for (var i = 0; i < 50000; ++i) |
| elems[i] = document.createElement('div'); |
| var observer = new WebKitMutationObserver(listener); |
| var tickledSpan = document.createElement('span'); |
| observer.observe(tickledSpan, {attributes: true}); |
| tickledSpan.setAttribute('data-foo', numRuns); |
| function listener(mutations) { |
| var time = Date.now() - start; |
| PerfTestRunner.log(time); |
| observer.observe(sandbox, {childList: true, subtree: true}); |
| for (var i = 0; i < elems.length; ++i) |
| node.appendChild(elems[i]); |
| PerfTestRunner.logStatistics(times); |
| PerfTestRunner.log('\n------------\n'); |
| PerfTestRunner.log('Running ' + numRuns + ' times with observation'); |
| PerfTestRunner.log('Running ' + numRuns + ' times without observation'); |
| window.addEventListener('load', runAgain); |