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

Reimplemented error tree disambiguation in Java #2035

Open
wants to merge 10 commits into
base: error-recovery
Choose a base branch
from

Conversation

PieterOlivier
Copy link
Contributor

@PieterOlivier PieterOlivier commented Oct 2, 2024

This PR replaces the (naive) error disambiguation filter written in Rascal. The time complexity has been reduced from O(n^2) to O(n), where n is the number of nodes in the original parse forest.

In practice this means that in extreme scenarios (where there are many ambiguous error trees), the time it takes to disambiguate a parse forest is about the same as the time it takes to parse the input.

For instance, in the SlowDisambiguationBug test case included in this PR both the parse time and disambiguation time are around 5 seconds on my machine. Disambiguation in Rascal took +- 30 minutes.

@PieterOlivier PieterOlivier mentioned this pull request Oct 2, 2024
Copy link
Member

@DavyLandman DavyLandman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement 👍

I have some clarification questions, and some ideas to increase performance.

Have you measured the performance with a profiler, since 3 seconds might still be a lot, especially compared to original parsing time.

Also, optimized the case where no changes are detected in subtrees.
* possibly without ambiguities.
*/

public synchronized IConstructor disambiguateErrors(IConstructor arg, IBool allowAmbiguity) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not need to by synchronized anymore.

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.

2 participants