Skip to content

Latest commit

 

History

History
16 lines (8 loc) · 1.03 KB

README.md

File metadata and controls

16 lines (8 loc) · 1.03 KB

Boyer-Moore string search

This is an implementation of the Boyer-Moore string search algorithm in Rust (0.2-pre). See Wikipedia, and Charras and Lecroq.

I've tried to calculate the prefix table as Charras and Lecroq do, but through my mistakes (or through Rust 0.1's inefficiencies) Boyer-Moore-Horspool outperforms Boyer-Moore, across the board.

Although I had high hopes, given how small the searches done in existing Rust code tend to be I don't think either algorithm as they stand makes sense to add to the Rust core::str library. (Currently, the average needle is about 8 bytes and average haystack is about 18 bytes...) But someone may find these functions useful, later.

// Kevin Cantu

Comparison

Boyer-Moore and naive search performance with random strings

Boyer-Moore-Horspool and naive search performance with random strings