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

improve parser performance #520

Merged
merged 1 commit into from
Mar 2, 2016
Merged

improve parser performance #520

merged 1 commit into from
Mar 2, 2016

Conversation

alexlamsl
Copy link
Collaborator

Measured ~5% speed improvement on es6.html when running benchmark.js

@alexlamsl
Copy link
Collaborator Author

The diff on github makes it look really dramatic, but in summary what I did:

  • moved html.indexOf('<') from text handling forward, as all the other blocks depends on < being the foremost character to be processed, thus saving the transversal through all the case mismatches when text blocks are encountered
  • record and update last tag name instead of repeatedly calling stack.last(), also prevents modifying the array object prototype which may have performance penalties

@kangax
Copy link
Owner

kangax commented Mar 2, 2016

Cool, feel free to merge (once it's rebased). As long as all tests are passing and code doesn't look too cryptic, I'm ok :D

kangax added a commit that referenced this pull request Mar 2, 2016
@kangax kangax merged commit 7e33f1b into kangax:gh-pages Mar 2, 2016
@alexlamsl alexlamsl mentioned this pull request Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants