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

Link based parse memoization #2100

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

PieterOlivier
Copy link
Contributor

During conversion of the parse graph to a parse forest, AbstractNode was used as a memoization key. This turned out to be incorrect even with the "no memoization within cycles" hack.

The memoCycleBug test in this PR tests for this problem.

The solution turned out to be to use the Link objects as memoization key instead. This ensures correct conversion from parse graph to parse forest and as a bonus improved performance when a lot of cycles are present as memoization can occur normally within cycles.

Note that this means all of the CycleMark related code has also been removed as it was only used to disable memoization within cycles.

Copy link

codecov bot commented Dec 14, 2024

Codecov Report

Attention: Patch coverage is 67.07317% with 27 lines in your changes missing coverage. Please review.

Project coverage is 49%. Comparing base (d83ff92) to head (539cace).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ser/gtd/result/out/ListContainerNodeFlattener.java 68% 11 Missing and 3 partials ⚠️
...ser/gtd/result/out/SortContainerNodeFlattener.java 64% 10 Missing and 2 partials ⚠️
...pl/parser/gtd/result/out/DefaultNodeFlattener.java 75% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2100   +/-   ##
=======================================
  Coverage       49%     49%           
- Complexity    6318    6334   +16     
=======================================
  Files          666     665    -1     
  Lines        59695   59672   -23     
  Branches      8670    8663    -7     
=======================================
+ Hits         29601   29605    +4     
+ Misses       27860   27834   -26     
+ Partials      2234    2233    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jurgenvinju
Copy link
Member

Perhaps @arnoldlankamp would also have a look?

Arnold, this fix was very well regression tested; but it would be great if you can interpret these changes and tell us what you think. The issues that were solved were strictly related to cycles on the parse graph (i.e. reductions without accepting any characters, arriving at an earlier node again).

@arnoldlankamp
Copy link
Contributor

@jurgenvinju Sure, I'll have a look when I have some time.

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.

3 participants