-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Improve performance when parsing invalid queries #27513
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
base: master
Are you sure you want to change the base?
Conversation
Use BailErrorStrategy as recommended by the ANTLR team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
martint
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any (micro-)benchmark results for this change?
| catch (ParsingException ex) { | ||
| catch (ParseCancellationException e) { | ||
| // if we fail, parse with LL mode | ||
| tokenStream.seek(0); // rewind input stream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this disappear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Parser.reset() method already does this
|
This is more about doing it in the correct way, that could theoretically improve performance. I don't actually care about the performance and didn't bother to benchmark it. This could alternatively be titled
|
Use
BailErrorStrategyas recommended by the ANTLR team in antlr/antlr4#192Release notes
(x) This is not user-visible or is docs only, and no release notes are required.