summaryrefslogtreecommitdiff
path: root/bs4/diagnose.py
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/diagnose.py')
-rw-r--r--bs4/diagnose.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/bs4/diagnose.py b/bs4/diagnose.py
index a2b405b..ad79d8a 100644
--- a/bs4/diagnose.py
+++ b/bs4/diagnose.py
@@ -179,6 +179,13 @@ def benchmark_parsers(num_elements=100000):
b = time.time()
print "Raw lxml parsed the markup in %.2fs." % (b-a)
+ import html5lib
+ parser = html5lib.HTMLParser()
+ a = time.time()
+ parser.parse(data)
+ b = time.time()
+ print "Raw html5lib parsed the markup in %.2fs." % (b-a)
+
def profile(num_elements=100000, parser="lxml"):
filehandle = tempfile.NamedTemporaryFile()
@@ -196,4 +203,5 @@ def profile(num_elements=100000, parser="lxml"):
if __name__ == '__main__':
#diagnose(sys.stdin.read())
- profile(parser="lxml")
+ profile(1000, parser="html5lib")
+ # benchmark_parsers()