Re:The Boyer-Moore Fast String Searching Algorithm
by taeric on Friday April 23, 2021 @10:09AM
(#26914934)
Burntsushi has plenty of data showing it isn't the best nowadays. Pretty sure any version that goes quadratic is bite BM, though. Not that you are wrong, but just highlighting that most folks don't think of BM when they think they are, though.
I haven't recently looked into the sub-quadratic worst case improved version of BM, but IIRC it's far from trivial and not what most people think of for this algorithm. I assume it's also slower IRL, for cache misses, or for expensive operations like modulo in the main loop, and prolly has a space penalty.
BM just has a better average case than naive string search.