Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html5 parser is significantly slower than default jsdom parser #25

Open
kirbysayshi opened this issue Mar 25, 2011 · 4 comments
Open

html5 parser is significantly slower than default jsdom parser #25

kirbysayshi opened this issue Mar 25, 2011 · 4 comments

Comments

@kirbysayshi
Copy link

Using jsdom, I have two snippets that load the same huge html. One snippet, using html5 as jsdom's parser, takes 70 seconds to process. The other, using just jsdom's parser, takes 10 seconds.

https://gist.github.com/886348#file_html5parser.js : takes 70 seconds, uses html5
https://gist.github.com/886348#file_defaultparser.js : takes 10 seconds, does not use html5
https://gist.github.com/886348#file_get_html.sh : run this quick command to download the test html

Of course, the lag could be within jsdom itself, but I haven't written a case to test that yet. The gist was initially written for a different bug I filed with jsdom, but it works here too.

This is definitely an edge case, since the html is such a large file (it's probably one of the largest wikipedia documents), but I was testing worst-case scenarios, and 70 seconds is a bit much! :)

@ghost ghost assigned aredridel Apr 11, 2011
@aredridel
Copy link
Owner

Speed is on the to-do list. I've been focusing on correctness first, then I'll tackle speed.

@kirbysayshi
Copy link
Author

Sounds like the priorities are proper. Thanks for your hard work!

@danyaPostfactum
Copy link
Collaborator

I'm working on this issue. My goal is to get speed close to htmlparser2 speed (may be up to 2 times slower).
Character reference handling is the real hot spot, but this is not the only issue.

Addidinally, I refactor code and change API (I'll create new branch)

@aredridel
Copy link
Owner

AWESOME, @danyaPostfactum. Thank you!

aredridel pushed a commit that referenced this issue Jan 26, 2014
Update tests that involve <frame> in <template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants