https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83607
Bug ID: 83607 Summary: std::boyer_moore_searcher is slow searching through arrays of std::byte Product: gcc Version: 7.2.1 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: m101010a at gmail dot com Target Milestone: --- Created attachment 42975 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42975&action=edit C++17 program demonstrating the issue When using std::boyer_moore_searcher on an array of std::bytes, it is 3 times as slow as memmem. When using std::boyer_moore_searcher on an array of unsigned char, it is faster them memmem. This is because the searcher uses an array when searching through unsigned chars, but uses a hash table when searching through std::byte. Searches through std::byte should also use an array, since it has the same size and equality semantics as unsigned char.