Earlier quoted context omitted.
Yeah I wrote that Wikipedia article, as much as a single person can. Used the textbook Strings, Trees, and Sequences by Gusfield; it never made mention of Rytter. I wouldn't say Wikipedia is a "terrible" source, though; compared to what? Papers? Textbooks? During the course of my career I've found major technical errors in about half of CS papers. Now the error is being documented & fixed in the Wikipedia article. My…
> you're guaranteed to have some bugs when implementing BM. Writing your own string search function seems nearly on the same level as implementing your own cryptographic functions, though. And that’s the Curse Of The Standard Library Implementers: we’re the ones that have to implement Boyer-Moore, floating-point string conversions, etc. so everyone else can use them :-)
Fix Boyer-Moore searcher with the Rytter correction
51–56 of 56 posts
Re: Fix Boyer-Moore searcher with the Rytter correction
#52Re: Fix Boyer-Moore searcher with the Rytter correction
#53Earlier quoted context omitted.
> you're guaranteed to have some bugs when implementing BM. Writing your own string search function seems nearly on the same level as implementing your own cryptographic functions, though. And that’s the Curse Of The Standard Library Implementers: we’re the ones that have to implement Boyer-Moore, floating-point string conversions, etc. so everyone else can use them :-)
Why aren't there projects amongst the standard library maintainers to make some standard tests and maybe even APIs? That way you'd know that every library implements each algorithm correctly.
Re: Fix Boyer-Moore searcher with the Rytter correction
#54Re: Fix Boyer-Moore searcher with the Rytter correction
#55Any one know why the Turbo Boyer-Moore algorithm is not more popular. Any case when Boyer Moore would be better?
There are literally hundreds of string search algorithms published now (including a large number of Boyer Moore variants). 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…
The cited implementation has only minor problems, which I fixed in my fork.
Re: Fix Boyer-Moore searcher with the Rytter correction
#56A while back I filed an issue on the MSVC std::vector implementation as the behaviour of a weird corner case differed from GCC/Clang. The reply I got from STL himself was fantastic, pointing out that it was [paraphrasing here] a wart in the spec, and that neither were actually incorrect. To my lasting regret, I didn't keep an ahem offsite backup of some of those corp emails. Hence I can't recall the exact details.
This sounds like the vector >> fiasco, where a vector contains elements that are movable-only (you can't copy a list >, only move it), yet with throwing move constructors (as MSVC's list, set, and other node-based containers dynamically allocate sentinel nodes when default/move-constructed - this is a behavior difference from GCC's libstdc++ and Clang's libc++, where both dynamically-allocated and container-internal…
Yes, that's the one! Our fix was explicitly deleting the copy constructor. In essence a one-liner for us, but you can't see the iceberg of an issue beneath the surface.
Thanks once again. :)