Blindly searching through all potential matchers is expensive. There should be class that provides the matchers in an iterable order of the most likely to be hit. Some optimizations that come to mind:
- Keep a mapping of command names to matchers that are only allowed as shallow ones
- Maybe also deep ones, after that?
Each search will need a map of which commands have already been attempted to match.
Blindly searching through all potential matchers is expensive. There should be class that provides the matchers in an iterable order of the most likely to be hit. Some optimizations that come to mind:
Each search will need a map of which commands have already been attempted to match.