Fix Boyer-Moore searcher with the Rytter correction
11–20 of 56 posts
Re: Fix Boyer-Moore searcher with the Rytter correction
#12 const auto elapsed = steady_clock::now() - start;
if (elapsed > 10s) {
actually use a units quantifier on the 10, i.e. does 10s mean 10 seconds? Is that a library thing? Cool if so.Re: Fix Boyer-Moore searcher with the Rytter correction
#13What I find most interesting about this bugfix is simply how terrible of a source Wikipedia is and, at the same time, how valuable professional insight can be (e.g. someone that knows what they're talking about). And to add insult to injury, someone quickly edited Wikipedia (for the "street cred" I'm sure): > The original paper contained errors for computing the table of pattern shifts which was corrected by Wojciech…
Re: Fix Boyer-Moore searcher with the Rytter correction
#14Re: Fix Boyer-Moore searcher with the Rytter correction
#15What is a minimal test case (needle + haystack) for which the old code yields a different result than the new code?
https://github.com/microsoft/STL/pull/724/commits/a7da5cce8c...
Looks like it can happen with quite small needles, eg. "aa".
Re: Fix Boyer-Moore searcher with the Rytter correction
#16Nice fix! It's been a while since I've done c++ so does the following code const auto elapsed = steady_clock::now() - start; if (elapsed > 10s) { actually use a units quantifier on the 10, i.e. does 10s mean 10 seconds? Is that a library thing? Cool if so.
Re: Fix Boyer-Moore searcher with the Rytter correction
#17Nice fix! It's been a while since I've done c++ so does the following code const auto elapsed = steady_clock::now() - start; if (elapsed > 10s) { actually use a units quantifier on the 10, i.e. does 10s mean 10 seconds? Is that a library thing? Cool if so.
the std::chrono library reserved some suffixes (under std::literals::chrono_literals) for time units https://en.cppreference.com/w/cpp/symbol_index/chrono_litera...
Re: Fix Boyer-Moore searcher with the Rytter correction
#18What I find most interesting about this bugfix is simply how terrible of a source Wikipedia is and, at the same time, how valuable professional insight can be (e.g. someone that knows what they're talking about). And to add insult to injury, someone quickly edited Wikipedia (for the "street cred" I'm sure): > The original paper contained errors for computing the table of pattern shifts which was corrected by Wojciech…
dude, instead of bitching, fix it
Re: Fix Boyer-Moore searcher with the Rytter correction
#19Any one know why the Turbo Boyer-Moore algorithm is not more popular. Any case when Boyer Moore would be better?
There's a great resource called SMART for those interested in exploring this, with implementations of many of them and a simple benchmarking tool.
https://smart-tool.github.io/smart/
Although Boyer Moore is well known, there are generally faster algorithms available these days.
For short patterns, SHIFTOR will tend to be a lot faster than BM. Even the much simpler variant of BM, Horspool is usually faster than BM.
This highlights an interesting tension in search algorithm design. Often a simpler algorithm outperforms one with theoretically higher performance, but not always!
Re: Fix Boyer-Moore searcher with the Rytter correction
#20I did a version in 68K on the Mac (MPW Shell days) for a SGML editor I was working on.