Skip to content

Optimize parsing #19976

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

Merged
merged 8 commits into from
Nov 16, 2017
Merged

Optimize parsing #19976

merged 8 commits into from
Nov 16, 2017

Conversation

ahejlsberg
Copy link
Member

@ahejlsberg ahejlsberg commented Nov 13, 2017

This PR optimizes our handling of JSDoc comment parsing resulting in parse time improvements of 6-7%. Previously, on every AST node where a JSDoc comment could occur we would always re-scan the whitespace preceding the node during finalization of the node object. Now, the scanner provides a flag to indicate if any JSDoc comments precede the current node, and we use this information to only process JSDoc comments when they are actually present.

@ahejlsberg
Copy link
Member Author

Note that #19979 broke parsing of arrow functions in one case. See here:

https://github.com/Microsoft/TypeScript/pull/19979/files#diff-5158944ac4103f3398a8f41ae0139069

The commit above to improve lookahead for arrow functions fixes this.

@ahejlsberg
Copy link
Member Author

@mhegazy I'd like to merge this one, so take a look when you can. Other than the 6-7% improvement it contains a fix to a regression. See above.

@ahejlsberg ahejlsberg merged commit b6f9605 into master Nov 16, 2017
@ahejlsberg ahejlsberg deleted the optimizeParser branch November 16, 2017 18:19
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants