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

Faster Parser #12

Closed
srhickma opened this issue Aug 15, 2018 · 6 comments
Closed

Faster Parser #12

srhickma opened this issue Aug 15, 2018 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@srhickma
Copy link
Owner

Investigate where slow-ups occur in the Earley parser, if optimations cannot be made, look for a faster parser.

@srhickma srhickma added the enhancement New feature or request label Aug 15, 2018
@srhickma srhickma self-assigned this Aug 15, 2018
@srhickma
Copy link
Owner Author

srhickma commented Sep 3, 2018

After #21, the Earley parser's parse tree generation is much more performant, and after #20, the recognition phase should run optimally for all grammars.

@srhickma
Copy link
Owner Author

srhickma commented Nov 5, 2018

Currently, parse tree construction appears to run linearly or better in the length of the input, whereas recognition appears to run in quadratic time.

@srhickma
Copy link
Owner Author

srhickma commented Nov 5, 2018

@srhickma
Copy link
Owner Author

Leo parsing modification https://www.sciencedirect.com/science/article/pii/030439759190180A. Try this before looking at the full MARPA implementation above. It is probably worth looking at an online algorithm for chunked parse tree generation and formatting before making the switch to one of these parsers.

@srhickma
Copy link
Owner Author

srhickma commented Dec 3, 2018

Building the project with the --release flag saw a substantial increase in performance. Duration of the java8 formatter tests went from an average of 6550 ms using cargo build to an average of 250 ms using cargo build --release. With such a large increase in performance here, the formatter is performant enough for real-world usage to be possible, and this issue should be closed. Further optimizations should be made down the line (especially wrt right recursion), but for the time being performance is no longer a blocker.

@srhickma
Copy link
Owner Author

srhickma commented Dec 3, 2018

At the time of writing, the entirety of the Spring Framework (~7000 files and ~1,300,000 lines) can be formatted in just over 51 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant