Caching calculations made during matching
drmfinlay opened this issue · comments
The matching process doesn't scale well to matching strings for large grammars. This is because of many calls to methods like Expansion.mutually_exclusive_of
. I'm thinking that intelligent caching of calculations like this could increase the performance. Some work on this is in feat/lookup-optimisations.
The cache for a rule (at the root expansion or in the Rule
object) could be populated with calculations using a JointTreeContext
. If the rule's joint expansion tree has children lists modified, then the cache would need to be updated. This could be checked using a (string) representation of the joint tree in Rule.matches
.