This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/83607] New: std::boyer_moore_searcher is slow searching through arrays of std::byte
- From: "m101010a at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Dec 2017 03:07:28 +0000
- Subject: [Bug libstdc++/83607] New: std::boyer_moore_searcher is slow searching through arrays of std::byte
- Auto-submitted: auto-generated
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.