DM-45844: Avoid creating identical parsers #1084
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Building parsers is expensive, now
ParserYacc
keeps a cache of parsers,there is one parser created per combination of keyword parameters. In
reality there will be just one parser because we do not pass any non-default
parameters to constructor. This makes repeated construction or
ParserYacc
significantly faster, timing shows reduction from 6.6 sec to 0.3 msec per
1000 instantiations.
This commit removes option for identifier substitution at parser level (
idMap
parameter for
ParserYacc
). We never used that option, its presence madereusable parsers hard to implement. We handle identifiers in our visitor classes,
so there is no impact on our code. The only use of that option in the unit tests
was also removed.
Also added type annotations to parserLex and parserYacc modules.
Checklist
doc/changes
configs/old_dimensions