systemd-cron-next/vendor/memchr
2024-11-12 15:03:58 +03:00
..
benches Cargo vendor 2024-11-12 15:03:58 +03:00
src Cargo vendor 2024-11-12 15:03:58 +03:00
.cargo-checksum.json Cargo vendor 2024-11-12 15:03:58 +03:00
appveyor.yml Cargo vendor 2024-11-12 15:03:58 +03:00
Cargo.toml Cargo vendor 2024-11-12 15:03:58 +03:00
COPYING Cargo vendor 2024-11-12 15:03:58 +03:00
ctags.rust Cargo vendor 2024-11-12 15:03:58 +03:00
LICENSE-MIT Cargo vendor 2024-11-12 15:03:58 +03:00
Makefile Cargo vendor 2024-11-12 15:03:58 +03:00
README.md Cargo vendor 2024-11-12 15:03:58 +03:00
session.vim Cargo vendor 2024-11-12 15:03:58 +03:00
UNLICENSE Cargo vendor 2024-11-12 15:03:58 +03:00

This crate provides two functions, memchr and memrchr, which exposes a safe interface to the corresponding functions in libc. This crate also provides fallback implementations when either function is unavailable.

Build status Build status

Dual-licensed under MIT or the UNLICENSE.

Documentation

http://burntsushi.net/rustdoc/memchr/.

Performance

On my system (Linux/amd64), memchr is about an order of magnitude faster than the more idiomatic haystack.iter().position(|&b| b == needle):

test iterator          ... bench:       5,280 ns/iter (+/- 13) = 1893 MB/s
test iterator_reversed ... bench:       5,271 ns/iter (+/- 7) = 1897 MB/s
test libc_memchr       ... bench:         202 ns/iter (+/- 0) = 49504 MB/s
test libc_memrchr      ... bench:         197 ns/iter (+/- 1) = 50761 MB/s