Closed advikkabra closed 7 months ago
As an aside, as recommended by #2355, we can improve these algorithms further and benchmark them if need be. There may be variations of the Boyer-Moore algorithm which work better, as the issue suggests, but I have used KMP as it is previously used for the string find method. I can work on testing and benchmarking them if the current algorithms are to be changed.
@certik Could you review this PR?
Implemented the Knuth-Morris-Pratt algorithm for
str.count()
, similar to thestr.find()
implementation. This should improve speed significantly in many cases.