Twoway / Fast substring search for strings and byte strings (Rust) / Also assorted benchmarks and string search snippets
APACHE-2.0 License
This is my substring search workspace.
Please read the API documentation here
__
|build_status|_ |crates|_
.. |build_status| image:: https://travis-ci.org/bluss/twoway.svg?branch=master .. _build_status: https://travis-ci.org/bluss/twoway
.. |crates| image:: http://meritbadge.herokuapp.com/twoway .. _crates: https://crates.io/crates/twoway
Fast substring search for strings and byte strings, using the two-way algorithm
_.
This is the same code as is included in Rust's libstd to “power” str::find(&str)
,
but here it is exposed with some improvements:
Available for byte string searches using &[u8]
Having an optional SSE4.2 accelerated version (if detected at runtime) which is even faster.
Using memchr
for the single byte case, which is ultra fast.
twoway::find_bytes(text: &[u8], pattern: &[u8]) -> Option<usize>
twoway::rfind_bytes(text: &[u8], pattern: &[u8]) -> Option<usize>
twoway::find_str(text: &str, pattern: &str) -> Option<usize>
twoway::rfind_str(text: &str, pattern: &str) -> Option<usize>
0.2.1
0.2.0
std::arch
and transparently support SSE4.2 when possible (x86 and0.1.8
0.1.7
no_std
. Regular and pcmp
both support this0.1.6
0.1.5
unchecked-index
instead0.1.4
0.1.3
pcmp
's itertools dependency0.1.2
pcmp
module.0.1.1
rfind_bytes
, rfind_str
0.1.0
find_bytes
, find_str
MIT / APACHE-2.0
.. _two-way algorithm
: http://www-igm.univ-mlv.fr/~lecroq/string/node26.html
Consider denying 0/n factorizations, see http://lists.gnu.org/archive/html/bug-gnulib/2010-06/msg00184.html