зеркало из https://github.com/mozilla/gecko-dev.git
15328d6b4f
MozReview-Commit-ID: 6eeqvTqSxam --HG-- rename : third_party/rust/memchr/.cargo-checksum.json => third_party/rust/memchr-1.0.2/.cargo-checksum.json rename : third_party/rust/memchr/Cargo.toml => third_party/rust/memchr-1.0.2/Cargo.toml rename : third_party/rust/memchr/src/lib.rs => third_party/rust/memchr-1.0.2/src/lib.rs rename : third_party/rust/regex/.cargo-checksum.json => third_party/rust/regex-0.2.2/.cargo-checksum.json rename : third_party/rust/regex/.travis.yml => third_party/rust/regex-0.2.2/.travis.yml rename : third_party/rust/regex/CHANGELOG.md => third_party/rust/regex-0.2.2/CHANGELOG.md rename : third_party/rust/regex/Cargo.toml => third_party/rust/regex-0.2.2/Cargo.toml rename : third_party/rust/regex/HACKING.md => third_party/rust/regex-0.2.2/HACKING.md rename : third_party/rust/regex/PERFORMANCE.md => third_party/rust/regex-0.2.2/PERFORMANCE.md rename : third_party/rust/regex/README.md => third_party/rust/regex-0.2.2/README.md rename : third_party/rust/regex/appveyor.yml => third_party/rust/regex-0.2.2/appveyor.yml rename : third_party/rust/regex/ci/after_success.sh => third_party/rust/regex-0.2.2/ci/after_success.sh rename : third_party/rust/regex/ci/run-kcov => third_party/rust/regex-0.2.2/ci/run-kcov rename : third_party/rust/regex/ci/script.sh => third_party/rust/regex-0.2.2/ci/script.sh rename : third_party/rust/regex/examples/bug347.rs => third_party/rust/regex-0.2.2/examples/bug347.rs rename : third_party/rust/regex/examples/shootout-regex-dna-bytes.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-dna-bytes.rs rename : third_party/rust/regex/examples/shootout-regex-dna-single.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-dna-single.rs rename : third_party/rust/regex/examples/shootout-regex-dna.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-dna.rs rename : third_party/rust/regex/examples/shootout-regex-redux-1.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-redux-1.rs rename : third_party/rust/regex/examples/shootout-regex-redux-chunked.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-redux-chunked.rs rename : third_party/rust/regex/examples/shootout-regex-redux.rs => third_party/rust/regex-0.2.2/examples/shootout-regex-redux.rs rename : third_party/rust/regex/scripts/unicode.py => third_party/rust/regex-0.2.2/scripts/unicode.py rename : third_party/rust/regex/src/backtrack.rs => third_party/rust/regex-0.2.2/src/backtrack.rs rename : third_party/rust/regex/src/compile.rs => third_party/rust/regex-0.2.2/src/compile.rs rename : third_party/rust/regex/src/dfa.rs => third_party/rust/regex-0.2.2/src/dfa.rs rename : third_party/rust/regex/src/error.rs => third_party/rust/regex-0.2.2/src/error.rs rename : third_party/rust/regex/src/exec.rs => third_party/rust/regex-0.2.2/src/exec.rs rename : third_party/rust/regex/src/expand.rs => third_party/rust/regex-0.2.2/src/expand.rs rename : third_party/rust/regex/src/input.rs => third_party/rust/regex-0.2.2/src/input.rs rename : third_party/rust/regex/src/lib.rs => third_party/rust/regex-0.2.2/src/lib.rs rename : third_party/rust/regex/src/literals.rs => third_party/rust/regex-0.2.2/src/literals.rs rename : third_party/rust/regex/src/pikevm.rs => third_party/rust/regex-0.2.2/src/pikevm.rs rename : third_party/rust/regex/src/prog.rs => third_party/rust/regex-0.2.2/src/prog.rs rename : third_party/rust/regex/src/re_builder.rs => third_party/rust/regex-0.2.2/src/re_builder.rs rename : third_party/rust/regex/src/re_bytes.rs => third_party/rust/regex-0.2.2/src/re_bytes.rs rename : third_party/rust/regex/src/re_plugin.rs => third_party/rust/regex-0.2.2/src/re_plugin.rs rename : third_party/rust/regex/src/re_set.rs => third_party/rust/regex-0.2.2/src/re_set.rs rename : third_party/rust/regex/src/re_trait.rs => third_party/rust/regex-0.2.2/src/re_trait.rs rename : third_party/rust/regex/src/re_unicode.rs => third_party/rust/regex-0.2.2/src/re_unicode.rs rename : third_party/rust/regex/src/simd_accel/mod.rs => third_party/rust/regex-0.2.2/src/simd_accel/mod.rs rename : third_party/rust/regex/src/simd_accel/teddy128.rs => third_party/rust/regex-0.2.2/src/simd_accel/teddy128.rs rename : third_party/rust/regex/src/simd_fallback/mod.rs => third_party/rust/regex-0.2.2/src/simd_fallback/mod.rs rename : third_party/rust/regex/src/simd_fallback/teddy128.rs => third_party/rust/regex-0.2.2/src/simd_fallback/teddy128.rs rename : third_party/rust/regex/src/utf8.rs => third_party/rust/regex-0.2.2/src/utf8.rs rename : third_party/rust/regex/tests/api_str.rs => third_party/rust/regex-0.2.2/tests/api_str.rs rename : third_party/rust/regex/tests/bytes.rs => third_party/rust/regex-0.2.2/tests/bytes.rs rename : third_party/rust/regex/tests/crazy.rs => third_party/rust/regex-0.2.2/tests/crazy.rs rename : third_party/rust/regex/tests/macros.rs => third_party/rust/regex-0.2.2/tests/macros.rs rename : third_party/rust/regex/tests/macros_bytes.rs => third_party/rust/regex-0.2.2/tests/macros_bytes.rs rename : third_party/rust/regex/tests/macros_str.rs => third_party/rust/regex-0.2.2/tests/macros_str.rs rename : third_party/rust/regex/tests/noparse.rs => third_party/rust/regex-0.2.2/tests/noparse.rs rename : third_party/rust/regex/tests/plugin.rs => third_party/rust/regex-0.2.2/tests/plugin.rs rename : third_party/rust/regex/tests/regression.rs => third_party/rust/regex-0.2.2/tests/regression.rs rename : third_party/rust/regex/tests/replace.rs => third_party/rust/regex-0.2.2/tests/replace.rs rename : third_party/rust/regex/tests/test_default.rs => third_party/rust/regex-0.2.2/tests/test_default.rs rename : third_party/rust/regex/tests/test_default_bytes.rs => third_party/rust/regex-0.2.2/tests/test_default_bytes.rs rename : third_party/rust/regex/tests/test_plugin.rs => third_party/rust/regex-0.2.2/tests/test_plugin.rs rename : third_party/rust/regex/tests/unicode.rs => third_party/rust/regex-0.2.2/tests/unicode.rs rename : third_party/rust/regex/tests/word_boundary_unicode.rs => third_party/rust/regex-0.2.2/tests/word_boundary_unicode.rs rename : third_party/rust/regex-syntax/.cargo-checksum.json => third_party/rust/regex-syntax-0.4.1/.cargo-checksum.json rename : third_party/rust/regex-syntax/Cargo.toml => third_party/rust/regex-syntax-0.4.1/Cargo.toml rename : third_party/rust/regex-syntax/src/lib.rs => third_party/rust/regex-syntax-0.4.1/src/lib.rs rename : third_party/rust/regex-syntax/src/literals.rs => third_party/rust/regex-syntax-0.4.1/src/literals.rs rename : third_party/rust/regex-syntax/src/parser.rs => third_party/rust/regex-syntax-0.4.1/src/parser.rs rename : third_party/rust/regex-syntax/src/properties.rs => third_party/rust/regex-syntax-0.4.1/src/properties.rs rename : third_party/rust/regex-syntax/src/unicode.rs => third_party/rust/regex-syntax-0.4.1/src/unicode.rs extra : rebase_source : b0c643eb68b9262945345145ec1578c14369dbf7 |
||
---|---|---|
.. | ||
benches | ||
src | ||
.cargo-checksum.json | ||
.travis.yml | ||
COPYING | ||
Cargo.toml | ||
LICENSE-MIT | ||
Makefile | ||
README.md | ||
UNLICENSE | ||
appveyor.yml | ||
ctags.rust | ||
session.vim |
README.md
This crate provides a safe interface libc
's memchr
and memrchr
.
This crate also provides fallback implementations when either function is
unavailable.
Dual-licensed under MIT or the UNLICENSE.
Documentation
no_std
memchr links to the standard library by default, but you can disable the
use_std
feature if you want to use it in a #![no_std]
crate:
[dependencies]
memchr = { version = "1.0", default-features = false }
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