-
Notifications
You must be signed in to change notification settings - Fork 30
Add memoization control (for now, C only) #236
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
Conversation
…ript to process statistics
Also remove spurious change to 'meta' variable syntax.
|
This will require precarious porting to the cpython branch at https://github.com/we-like-parsers/cpython :-( |
lysnikolaou
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.
It's a very small nit, but I think I'd prefer to not have whitespace between the type and the flags. Looks great otherwise!
Hm, I added that intentionally so the flags stand out a bit more -- it's a bit busy already with the type in square brackets. I'll just land, so we can find out the consequences for other work soon. |
This is a straightforward port of we-like-parsers/pegen_experiments#236 . In addition, slightly touched up .gitignore, Makefile (black), mypy.ini.
This is a straightforward port of we-like-parsers/pegen_experiments#236 . In addition, slightly touched up .gitignore, Makefile (black), mypy.ini.
Addresses #220 (comment)
Memoization is expensive. In the C generator, we now disable it except for rules with the special marker
(memo)after the rule name (and type, if present). By selectively turning on memoization for a handful of rules the parser becomes faster and uses less memory.Notes:
This also adds instrumentation to the C support code to measure how much each rule uses memoization.
Finally, it fixes two lines in scripts/test_parse_directory.py that were still using pegen/ instead of peg_parser/ as the output directory.