High speed string matching algorithms

algorithm, string

Solution

Two-way string matching is, to my knowledge, the best general-purpose algorithm for string matching. It has linear worst-case complexity, uses constant space, and doesn't backtrack too much more than necessary. And the theory behind it is very nice.

If you know that your users aren't jerks, naive string matching optimised for your architecture will win for short "needles" while a Boyer-Moore variant will start really doing the sublinear thing for long "needles." However, naive string matching has a quadratic worst case and Boyer-Moore can be made to examine all characters in the input. The extra tables needed to handle mismatches actually carry a surprisingly severe penalty over two-way string matching.

Problem

I'm basically benchmarking some high speed string matching algorithms, I came across a few. Backwards Non-deterministic DAWG (Directed acyclic word graph) Matching algorithm by Gonzalo Navarro and Mathieu Raffinot. See "A Bit-Parallel Approach to Suffix Automata: Fast Extended String Matching" Horspool's improved version of the Boyer-Moore String searching algorithm. See "Practical fast searching in strings" Shift-Or algorithm with mismatches KMP Are there any other better high speed string matching algorithms i can try ? Edit : There is another thread in similar lines , which has good references too

Original source