-
Notifications
You must be signed in to change notification settings - Fork 78
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
Reimplemented error tree disambiguation in Java #2035
Conversation
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.
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.
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
Also, optimized the case where no changes are detected in subtrees.
src/org/rascalmpl/library/lang/rascal/tests/concrete/recovery/ParseErrorDisambiguator.java
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/error-recovery #2035 +/- ##
=====================================================
Coverage ? 49%
Complexity ? 6556
=====================================================
Files ? 685
Lines ? 61077
Branches ? 8830
=====================================================
Hits ? 30155
Misses ? 28717
Partials ? 2205 ☔ View full report in Codecov by Sentry. |
Both when introducing error nodes and when disambiguating errors
Reimplemented error tree disambiguation in Java
Reimplemented error tree disambiguation in Java
Reimplemented error tree disambiguation in Java
This PR replaces the (naive) error disambiguation filter written in Rascal. The time complexity has been reduced from
O(n^2)
toO(n)
, wheren
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.