Add a version of the html-parser benchmark which uses srcdoc instead of document...
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jan 2013 22:53:14 +0000 (22:53 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Jan 2013 22:53:14 +0000 (22:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107158

Reviewed by Ryosuke Niwa.

Currently this test even opts-in to the threaded parser if available.
We'll remove that line when the threaded parser becomes default or goes away.

* Parser/html-parser-srcdoc.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140051 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/Parser/html-parser-srcdoc.html [new file with mode: 0644]
PerformanceTests/Skipped

index 11ba648..06a1c4b 100644 (file)
@@ -1,3 +1,15 @@
+2013-01-17  Eric Seidel  <eric@webkit.org>
+
+        Add a version of the html-parser benchmark which uses srcdoc instead of document.write so it tests the threaded parser
+        https://bugs.webkit.org/show_bug.cgi?id=107158
+
+        Reviewed by Ryosuke Niwa.
+
+        Currently this test even opts-in to the threaded parser if available.
+        We'll remove that line when the threaded parser becomes default or goes away.
+
+        * Parser/html-parser-srcdoc.html: Added.
+
 2013-01-16  Arnaud Renevier  <a.renevier@sisa.samsung.com>
 
         inconsistency in drawImage with target rect negative dimensions.
diff --git a/PerformanceTests/Parser/html-parser-srcdoc.html b/PerformanceTests/Parser/html-parser-srcdoc.html
new file mode 100644 (file)
index 0000000..3e8d16b
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+// Use the threaded parser if available:
+if (window.internals && window.internals.settings.setThreadedHTMLParser)
+    window.internals.settings.setThreadedHTMLParser(true);
+
+var spec = PerfTestRunner.loadFile("resources/html5.html");
+
+var iframe = document.createElement("iframe");
+iframe.style.display = "none";  // Prevent creation of the rendering tree, so we only test HTML parsing.
+iframe.sandbox = '';  // Prevent external script loads which could cause write() to return before completing the parse.
+document.body.appendChild(iframe);
+
+PerfTestRunner.prepareToMeasureValuesAsync({done: onCompletedRun, unit: 'ms'});
+
+iframe.onload = function() {
+    var now = PerfTestRunner.now();
+    PerfTestRunner.measureValueAsync(now - then);
+    then = now;
+    iframe.srcdoc = spec;
+}
+var then = PerfTestRunner.now();
+iframe.srcdoc = spec;
+
+function onCompletedRun() {
+    iframe.onload = null;
+    // FIXME: This should probably remove the iframe, but that currently
+    // causes the threaded-parser to never send the load event for the main page.
+    // document.body.removeChild(iframe);
+}
+</script>
+</body>
index 5fd4149..1fcf10f 100644 (file)
@@ -64,3 +64,8 @@ SVG/SvgNestedUse.html
 ShadowDOM
 
 Canvas/drawimage.html
+
+# Works fine, but is mostly useful to the threaded-parsing folks, as
+# it's very similar to parser/html-parser.html just using
+# srcdoc to load instead of document.write.
+parser/html-parser-srcdoc.html