From 69df10591f34136e56ec195c5eef05aaf5828011 Mon Sep 17 00:00:00 2001 From: Henning Koch Date: Wed, 27 Jun 2018 13:38:37 +0200 Subject: [PATCH] HTML Parsing: Update measure script --- design/measure_import_node.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/design/measure_import_node.js b/design/measure_import_node.js index bf71d61cc..37b5e056d 100644 --- a/design/measure_import_node.js +++ b/design/measure_import_node.js @@ -1,4 +1,4 @@ -ITERATIONS = 100; +ITERATIONS = 5000; CHUNK_SIZE = 10; HTML = "" + document.body.innerHTML + ""; @@ -140,7 +140,6 @@ function removeScripts(doc) { domParser = new DOMParser(); -/* experiment('PlainDOMParser', function() { var doc = domParser.parseFromString(HTML, "text/html"); var body = doc.querySelector('body'); @@ -148,8 +147,19 @@ experiment('PlainDOMParser', function() { throw "parsing failed"; } }); -*/ +experiment('CreateHTMLDocument', function() { + var doc = document.implementation.createHTMLDocument('') + doc.documentElement.innerHTML = HTML; + var body = doc.querySelector('body'); + if (!body) { + throw "parsing failed"; + } +}); + + + +/* experiment('DOMParserWithFixScripts', function() { var doc = domParser.parseFromString(HTML, "text/html"); var body = doc.querySelector('body'); @@ -158,6 +168,7 @@ experiment('DOMParserWithFixScripts', function() { } fixScripts(body); }); +*/ /* @@ -171,7 +182,7 @@ experiment('DOMParserWithImport', function() { }); */ - +/* var noScriptPattern = /]*>(.*?)<\/noscript>/i experiment('DOMParserWitSmartFixScripts', function() { @@ -313,7 +324,7 @@ experiment('SmartInnerHTMLWithRemoveScripts', function() { removeScripts(body); }); - +*/ pokeQueue();