Open jmeaster30 opened 1 year ago
The algorithm I was thinking of was Knuth Morris Pratt. It definitely can be extended to work with our use case. I think some of the other optimizations I have planned will assist with this.
https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm
Currently, when an expression fails to match it goes back to the offset that we started at and starts the next round of matching at the very next character. This is inefficient since if we are looking for 'abc' and failed on 'def' then we can skip all of those characters.
I was imagining something like Rabin-Karp or Knuth-Morris-Pratt string search algorithms