logo

Rust crates reviews

Cryptographically verifiable, distributed dependency reviews

crate: memchr

https://lib.rs/crates/memchr/

Add the last reviewed version to Cargo.toml / [dependencies]:

memchr = "2.4.1"

Filter reviews clicking on the numbers in the summary.

Full column names in tooltip hints: rating Negative, rating Neutral, rating Positive, rating Strong, thoroughness, understanding, reviews count.

Neg
Neu
Pos
Str
tho
und
rev
2
3
2
2
1
crate version
rating
date
reviewer
thoroughness, understanding
memchr 2.2.1
strong
2019-08-22
high, high

I wrote this crate, so this review is a reflection as a result of writing
the code and then reviewing it again for this review.

The entire purpose of the memchr crate is to do this:

haystack.iter().position(|&b| b == needle)

... but really fast. As a result, this crate uses SIMD via CPU specific
vendor intrinsics. Consequently, there is a lot of unsafe code in this
crate. There is really no way to avoid this, other than perhaps using a
higher level platform independent SIMD API. But no such thing of sufficient
quality exists for stable Rust at the time of writing.

The testing strategy is the most important bit here. In particular, every
public API item is tested using a permutation of tests that exercise all
possible alignments found in a haystack. (Because the implementations used
aligned loads/stores, which are only correct if the address arithmetic is
correct.) Additionally, there are quickcheck tests that act as a sort of
fuzzer guaranteeing that the implementation is correct for a range of inputs.

I gave the highest rating possible because of the extensive use this crate
has seen, in addition to its level of testing. In particular, memchr
underlies a significant chunk of all text search in the Rust ecosystem.

© bestia.dev 2023, MIT License, Version: 2023.608.1636

Open source repository for this web app: https://github.com/bestia-dev/cargo_crev_web/