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

Use incremental parsing #772

Closed
evhub opened this issue Jul 16, 2023 · 5 comments
Closed

Use incremental parsing #772

evhub opened this issue Jul 16, 2023 · 5 comments

Comments

@evhub
Copy link
Owner

evhub commented Jul 16, 2023

Should enable incremental parsing mode where parses are cached to improve recompilation times for slightly modified files.

@evhub evhub added this to the v3.0.3 milestone Jul 28, 2023
@evhub evhub mentioned this issue Jul 28, 2023
@evhub evhub removed this from the v3.0.3 milestone Jul 28, 2023
@evhub
Copy link
Owner Author

evhub commented Jul 28, 2023

The biggest problem with this is figuring out how to effectively store the references to individual grammar items in each item in the parse cache. Though we can certainly pickle and unpickle the cache, doing so creates new grammar objects rather than references to the existing grammar objects, which means the resulting unpickled cache is effectively useless.

What we would need for this is to assign every grammar object a unique, deterministic identifier, pickle and unpickle the identifiers rather than the grammar objects themselves, then look up grammar objects by their identifier when loading in the new cache.

@evhub evhub added this to the v3.0.4 milestone Jul 29, 2023
evhub added a commit that referenced this issue Jul 31, 2023
@evhub
Copy link
Owner Author

evhub commented Jul 31, 2023

--incremental is now supported as of coconut-develop>=3.0.3-post_dev3, but it needs more testing to verify that it's actually improving compilation times.

@evhub
Copy link
Owner Author

evhub commented Aug 2, 2023

Two things that need to be fixed with the current implementation:

  • parseIncremental in cPyparsing just shouldn't cache successes, only failures.
  • incremental_cache_limit results in only the parse at the end of the file being cached, which is useless the next time we go to parse the file, since the next parse will always start at the beginning.

@evhub
Copy link
Owner Author

evhub commented Aug 3, 2023

This works now, but it only provides performance improvements for small files, so it's automatically disabled for large files.

@evhub
Copy link
Owner Author

evhub commented Nov 12, 2023

With the new adaptive parsing , this is now providing substantial performance improvements for all files, so it should be enabled by default (and the --incremental option should be removed), though a --no-cache option should be added to disable use of the cache if necessary.

@evhub evhub changed the title Add --incremental compilation option Use incremental parsing Nov 17, 2023
@evhub evhub closed this as completed Nov 17, 2023
@evhub evhub mentioned this issue Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant