WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Bumped depth to 200
bug-71939-20111109113823.patch (text/plain), 11.10 KB, created by
Adam Klein
on 2011-11-09 11:38:24 PST
(
hide
)
Description:
Bumped depth to 200
Filename:
MIME Type:
Creator:
Adam Klein
Created:
2011-11-09 11:38:24 PST
Size:
11.10 KB
patch
obsolete
>Subversion Revision: 99734 >diff --git a/PerformanceTests/ChangeLog b/PerformanceTests/ChangeLog >index 3e5bb465af47af83063b21f846acbce1257a3a88..cdc6b79693fb49d837f8372248e9f2ea3d09ad0a 100644 >--- a/PerformanceTests/ChangeLog >+++ b/PerformanceTests/ChangeLog >@@ -1,3 +1,20 @@ >+2011-11-09 Adam Klein <adamk@chromium.org> >+ >+ [MutationObservers] Microbenchmarks for appendChild, removeChild, and innerHTML >+ https://bugs.webkit.org/show_bug.cgi?id=71939 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ These benchmarks time both the DOM mutations themselves and the time taken >+ to call the MutationCallback. This measurement is achieved by >+ executing the code entirely within the MutationCallback itself. >+ >+ * Mutation/append-child-deep.html: Added. Covers appendChild in a 200-node-deep tree with subtree observation. >+ * Mutation/append-child.html: Added. Covers appendChild in a flat tree. >+ * Mutation/inner-html.html: Added. Covers innerHTML adding and removing many nodes at a time. >+ * Mutation/remove-child-deep.html: Added. Covers removeChild in a 200-node-deep tree with subtree observation. >+ * Mutation/remove-child.html: Added. Covers removeChild in a flat tree. >+ > 2011-10-25 Adam Barth <abarth@webkit.org> > > EventTargetFactory.in is not sorted >diff --git a/PerformanceTests/Mutation/append-child-deep.html b/PerformanceTests/Mutation/append-child-deep.html >new file mode 100644 >index 0000000000000000000000000000000000000000..29d6355b668343978b3f2810e7b6748a84a5af28 >--- /dev/null >+++ b/PerformanceTests/Mutation/append-child-deep.html >@@ -0,0 +1,65 @@ >+<!DOCTYPE html> >+<body> >+<pre id="log"></pre> >+<script src="../Parser/resources/runner.js"></script> >+<div id="sandbox" style="display:none"></div> >+<script> >+var sandbox = document.getElementById('sandbox'); >+var node = sandbox; >+for (var i = 0; i < 200; ++i) { >+ node = node.appendChild(document.createElement('div')); >+} >+var elems = []; >+for (var i = 0; i < 50000; ++i) { >+ elems[i] = document.createElement('div'); >+} >+var observing = false; >+ >+var observer = new WebKitMutationObserver(listener); >+var tickledSpan = document.createElement('span'); >+observer.observe(tickledSpan, {attributes: true}); >+ >+function resetState() { >+ window.start = null; >+ window.numRuns = 25; >+ window.times = []; >+} >+ >+function runAgain() { >+ tickledSpan.setAttribute('data-foo', numRuns); >+} >+ >+function listener(mutations) { >+ if (start) { >+ var time = new Date().getTime() - start; >+ times.push(time); >+ log(time); >+ } >+ if (numRuns-- >= 0) { >+ runAgain(); >+ if (observing) >+ observer.disconnect() >+ node.innerHTML = ''; >+ if (observing) >+ observer.observe(sandbox, {childList: true, subtree: true}); >+ start = new Date().getTime(); >+ for (var i = 0; i < elems.length; ++i) { >+ node.appendChild(elems[i]); >+ } >+ } else { >+ logStatistics(times); >+ if (!observing) { >+ observing = true; >+ resetState(); >+ log('\n------------\n'); >+ log('Running ' + numRuns + ' times with observation'); >+ setTimeout(runAgain, 0); >+ } >+ } >+} >+ >+resetState(); >+log('Running ' + numRuns + ' times without observation'); >+window.addEventListener('load', runAgain); >+</script> >+</body> >diff --git a/PerformanceTests/Mutation/append-child.html b/PerformanceTests/Mutation/append-child.html >new file mode 100644 >index 0000000000000000000000000000000000000000..f61875e2a5d5892ffc67f51d4ac31bbc5fdd9f6f >--- /dev/null >+++ b/PerformanceTests/Mutation/append-child.html >@@ -0,0 +1,61 @@ >+<!DOCTYPE html> >+<body> >+<pre id="log"></pre> >+<script src="../Parser/resources/runner.js"></script> >+<div id="sandbox" style="display:none"></div> >+<script> >+var sandbox = document.getElementById('sandbox'); >+var observing = false; >+ >+var elems = []; >+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}); >+ >+function resetState() { >+ window.start = null; >+ window.numRuns = 25; >+ window.times = []; >+} >+ >+function runAgain() { >+ tickledSpan.setAttribute('data-foo', numRuns); >+} >+ >+function listener(mutations) { >+ if (start) { >+ var time = new Date().getTime() - start; >+ times.push(time); >+ log(time); >+ } >+ if (numRuns-- >= 0) { >+ runAgain(); >+ if (observing) >+ observer.disconnect() >+ sandbox.innerHTML = ''; >+ if (observing) >+ observer.observe(sandbox, {childList: true}); >+ start = new Date().getTime(); >+ for (var i = 0; i < elems.length; ++i) { >+ sandbox.appendChild(elems[i]); >+ } >+ } else { >+ logStatistics(times); >+ if (!observing) { >+ observing = true; >+ resetState(); >+ log('\n------------\n'); >+ log('Running ' + numRuns + ' times with observation'); >+ setTimeout(runAgain, 0); >+ } >+ } >+} >+ >+resetState(); >+log('Running ' + numRuns + ' times without observation'); >+window.addEventListener('load', runAgain); >+</script> >+</body> >diff --git a/PerformanceTests/Mutation/inner-html.html b/PerformanceTests/Mutation/inner-html.html >new file mode 100644 >index 0000000000000000000000000000000000000000..add4ded6c7a710d9d4c626211b524ddaf6618e69 >--- /dev/null >+++ b/PerformanceTests/Mutation/inner-html.html >@@ -0,0 +1,57 @@ >+<!DOCTYPE html> >+<body> >+<pre id="log"></pre> >+<script src="../Parser/resources/runner.js"></script> >+<div id="sandbox" style="display:none"></div> >+<script> >+var sandbox = document.getElementById('sandbox'); >+var observing = false; >+for (var i = 0; i < 1000; ++i) { >+ sandbox.appendChild(document.createElement('div')); >+} >+var html = sandbox.innerHTML; >+ >+var observer = new WebKitMutationObserver(listener); >+var tickledSpan = document.createElement('span'); >+observer.observe(tickledSpan, {attributes: true}); >+ >+function resetState() { >+ window.start = null; >+ window.numRuns = 25; >+ window.times = []; >+} >+ >+function runAgain() { >+ tickledSpan.setAttribute('data-foo', numRuns); >+} >+ >+function listener(mutations) { >+ if (start) { >+ var time = new Date().getTime() - start; >+ times.push(time); >+ log(time); >+ } >+ if (numRuns-- >= 0) { >+ runAgain(); >+ start = new Date().getTime(); >+ for (var i = 0; i < 100; ++i) { >+ sandbox.innerHTML = html; >+ } >+ } else { >+ logStatistics(times); >+ if (!observing) { >+ observer.observe(sandbox, {childList: true}); >+ observing = true; >+ resetState(); >+ log('\n------------\n'); >+ log('Running ' + numRuns + ' times with observation'); >+ setTimeout(runAgain, 0); >+ } >+ } >+} >+ >+resetState(); >+log('Running ' + numRuns + ' times without observation'); >+window.addEventListener('load', runAgain); >+</script> >+</body> >diff --git a/PerformanceTests/Mutation/remove-child-deep.html b/PerformanceTests/Mutation/remove-child-deep.html >new file mode 100644 >index 0000000000000000000000000000000000000000..16f97bf9c4de99eb6cbda713d6a4cff850a3055a >--- /dev/null >+++ b/PerformanceTests/Mutation/remove-child-deep.html >@@ -0,0 +1,68 @@ >+<!DOCTYPE html> >+<body> >+<pre id="log"></pre> >+<script src="../Parser/resources/runner.js"></script> >+<div id="sandbox" style="display:none"></div> >+<script> >+var sandbox = document.getElementById('sandbox'); >+var node = sandbox; >+for (var i = 0; i < 200; ++i) { >+ node = node.appendChild(document.createElement('div')); >+} >+var observing = false; >+ >+var observer = new WebKitMutationObserver(listener); >+var tickledSpan = document.createElement('span'); >+observer.observe(tickledSpan, {attributes: true}); >+ >+function resetState() { >+ window.start = null; >+ window.numRuns = 25; >+ window.times = []; >+} >+ >+function runAgain() { >+ tickledSpan.setAttribute('data-foo', numRuns); >+} >+ >+function hideFromObservation(func) { >+ if (observing) >+ observer.disconnect(); >+ func(); >+ if (observing) >+ observer.observe(sandbox, {childList: true, subtree: true}); >+} >+ >+function listener(mutations) { >+ if (start) { >+ var time = new Date().getTime() - start; >+ times.push(time); >+ log(time); >+ } >+ if (numRuns-- >= 0) { >+ runAgain(); >+ hideFromObservation(function() { >+ for (var i = 0; i < 50000; ++i) >+ node.appendChild(document.createElement('div')); >+ }); >+ start = new Date().getTime(); >+ while (node.firstChild) { >+ node.removeChild(node.firstChild); >+ } >+ } else { >+ logStatistics(times); >+ if (!observing) { >+ observing = true; >+ resetState(); >+ log('\n------------\n'); >+ log('Running ' + numRuns + ' times with observation'); >+ setTimeout(runAgain, 0); >+ } >+ } >+} >+ >+resetState(); >+log('Running ' + numRuns + ' times without observation'); >+window.addEventListener('load', runAgain); >+</script> >+</body> >diff --git a/PerformanceTests/Mutation/remove-child.html b/PerformanceTests/Mutation/remove-child.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6f4f7939e17da4f0a4698296ef7eba9eb683eb24 >--- /dev/null >+++ b/PerformanceTests/Mutation/remove-child.html >@@ -0,0 +1,65 @@ >+<!DOCTYPE html> >+<body> >+<pre id="log"></pre> >+<script src="../Parser/resources/runner.js"></script> >+<div id="sandbox" style="display:none"></div> >+<script> >+var sandbox = document.getElementById('sandbox'); >+var observing = false; >+ >+var observer = new WebKitMutationObserver(listener); >+var tickledSpan = document.createElement('span'); >+observer.observe(tickledSpan, {attributes: true}); >+ >+function resetState() { >+ window.start = null; >+ window.numRuns = 25; >+ window.times = []; >+} >+ >+function runAgain() { >+ tickledSpan.setAttribute('data-foo', numRuns); >+} >+ >+function hideFromObservation(func) { >+ if (observing) >+ observer.disconnect() >+ func(); >+ if (observing) >+ observer.observe(sandbox, {childList: true}); >+} >+ >+function listener(mutations) { >+ if (start) { >+ var time = new Date().getTime() - start; >+ times.push(time); >+ log(time); >+ } >+ if (numRuns-- >= 0) { >+ runAgain(); >+ hideFromObservation(function() { >+ for (var i = 0; i < 50000; ++i) >+ sandbox.appendChild(document.createElement('div')); >+ }); >+ start = new Date().getTime(); >+ while (sandbox.firstChild) { >+ sandbox.removeChild(sandbox.firstChild); >+ } >+ } else { >+ logStatistics(times); >+ if (!observing) { >+ observer.observe(sandbox, {childList: true}); >+ observing = true; >+ resetState(); >+ log('\n------------\n'); >+ log('Running ' + numRuns + ' times with observation'); >+ setTimeout(runAgain, 0); >+ } >+ } >+} >+ >+resetState(); >+log('Running ' + numRuns + ' times without observation'); >+window.addEventListener('load', runAgain); >+</script> >+</body>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 71939
:
114324
|
114330
|
114335