-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add memmem implementation, upgrade to Rust 2018, bump MSRV to Rust 1.41.1 #82
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was long overdue, but I had been busy with other things. This also bumps the MSRV to Rust 1.41, which is what is currently in Debian stable.
This basically bumps down all of the memchr tests/benchmarks into a sub-module in order to make room for tests/benchmarks for other APIs like memmem.
BurntSushi
force-pushed
the
ag/memmem
branch
3 times, most recently
from
April 30, 2021 11:05
7865405
to
d5cfcca
Compare
BurntSushi
force-pushed
the
ag/memmem
branch
4 times, most recently
from
April 30, 2021 18:09
317075f
to
7810d6c
Compare
BurntSushi
added a commit
to rust-lang/regex
that referenced
this pull request
Apr 30, 2021
This was long overdue, and we were motivated by memchr's move to Rust 2018 in BurntSushi/memchr#82. Rust 1.41.1 was selected because it's the current version of Rust in Debian Stable. It also feels old enough to assure wide support.
BurntSushi
added a commit
to BurntSushi/aho-corasick
that referenced
this pull request
Apr 30, 2021
This is in line with similar changes to the regex and memchr crates: BurntSushi/memchr#82 and rust-lang/regex#767
This commit primarily adds vectorized substring search routines in a new memmem sub-module. They were originally taken from bstr, but heavily modified to incorporate a variant of the "generic SIMD" algorithm[1]. The main highlights: * We guarantee `O(m + n)` time complexity and constant space complexity. * Two-Way is the primary implementation that can handle all cases. * Vectorized variants handle a number of common cases. * Vectorized code uses a heuristic informed by a frequency background distribution of bytes, originally devised inside the regex crate. This makes it more likely that searching will spend more time in the fast vector loops. While adding memmem to this crate is perhaps a bit of a scope increase, I think it fits well. It also puts a core primitive, substring search, very low in the dependency DAG and therefore making it widely available. For example, it is intended to use these new routines in the regex, aho-corasick and bstr crates. This commit does a number of other things, mainly as a result of convenience. It drastically improves test coverage for substring search (as compared to what bstr had), completely overhauls the benchmark suite to make it more comprehensive and adds `cargo fuzz` support for all API items in the crate. Closes #58, Closes #72 [1] - http://0x80.pl/articles/simd-strfind.html#algorithm-1-generic-simd
This makes it easy to link to benchmarks when someone asks, but also serves as a good way to archive benchmark data at defined points for comparison later. We also make a (feeble) attempt at putting a "pretty" version of a subset of benchmarks in the README of each run directory.
BurntSushi
added a commit
to BurntSushi/aho-corasick
that referenced
this pull request
Apr 30, 2021
This is in line with similar changes to the regex and memchr crates: BurntSushi/memchr#82 and rust-lang/regex#767
BurntSushi
added a commit
to rust-lang/regex
that referenced
this pull request
Apr 30, 2021
This was long overdue, and we were motivated by memchr's move to Rust 2018 in BurntSushi/memchr#82. Rust 1.41.1 was selected because it's the current version of Rust in Debian Stable. It also feels old enough to assure wide support.
BurntSushi
added a commit
to rust-lang/regex
that referenced
this pull request
Apr 30, 2021
This was long overdue, and we were motivated by memchr's move to Rust 2018 in BurntSushi/memchr#82. Rust 1.41.1 was selected because it's the current version of Rust in Debian Stable. It also feels old enough to assure wide support.
BurntSushi
added a commit
to rust-lang/regex
that referenced
this pull request
May 1, 2021
This was long overdue, and we were motivated by memchr's move to Rust 2018 in BurntSushi/memchr#82. Rust 1.41.1 was selected because it's the current version of Rust in Debian Stable. It also feels old enough to assure wide support.
This PR is on crates.io in |
Excellent, thanks for this! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit primarily adds vectorized substring search routines in
a new memmem sub-module. They were originally taken from bstr, but
heavily modified to incorporate a variant of the "generic SIMD"
algorithm[1]. The main highlights:
O(m + n)
time complexity and constant spacecomplexity.
distribution of bytes, originally devised inside the regex crate.
This makes it more likely that searching will spend more time in the
fast vector loops.
While adding memmem to this crate is perhaps a bit of a scope increase,
I think it fits well. It also puts a core primitive, substring
search, very low in the dependency DAG and therefore making it widely
available. For example, it is intended to use these new routines in the
regex, aho-corasick and bstr crates.
This commit does a number of other things, mainly as a result of
convenience. It drastically improves test coverage for substring search
(as compared to what bstr had), completely overhauls the benchmark suite
to make it more comprehensive and adds
cargo fuzz
support for all APIitems in the crate.
[1] - http://0x80.pl/articles/simd-strfind.html#algorithm-1-generic-simd