4 <script src=
"../resources/runner.js"></script>
5 <div id=
"sandbox" style=
"display:none"></div>
7 var sandbox
= document
.getElementById('sandbox');
9 for (var i
= 0; i
< 1000; ++i
)
10 sandbox
.appendChild(document
.createElement('div'));
11 var html
= sandbox
.innerHTML
;
13 var observer
= new WebKitMutationObserver(listener
);
14 var tickledSpan
= document
.createElement('span');
15 observer
.observe(tickledSpan
, {attributes
: true});
17 function resetState() {
24 tickledSpan
.setAttribute('data-foo', numRuns
);
27 function listener(mutations
) {
29 var time
= Date
.now() - start
;
31 PerfTestRunner
.log(time
);
36 for (var i
= 0; i
< 100; ++i
)
37 sandbox
.innerHTML
= html
;
39 PerfTestRunner
.logStatistics(times
);
41 observer
.observe(sandbox
, {childList
: true});
44 PerfTestRunner
.log('\n------------\n');
45 PerfTestRunner
.log('Running ' + numRuns
+ ' times with observation');
46 setTimeout(runAgain
, 0);
52 PerfTestRunner
.log('Running ' + numRuns
+ ' times without observation');
53 window
.addEventListener('load', runAgain
);