Copy disabled (too large)
Download .txt
Showing preview only (13,663K chars total). Download the full file to get everything.
Repository: BurntSushi/rust-memchr
Branch: master
Commit: db1a77d4b556
Files: 162
Total size: 44.2 MB
Directory structure:
gitextract_y3u5cs40/
├── .github/
│ ├── FUNDING.yml
│ ├── dependabot.yml
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .ignore
├── .vim/
│ └── coc-settings.json
├── COPYING
├── Cargo.toml
├── LICENSE-MIT
├── README.md
├── UNLICENSE
├── benchmarks/
│ ├── definitions/
│ │ ├── memchr/
│ │ │ └── sherlock/
│ │ │ ├── common.toml
│ │ │ ├── never.toml
│ │ │ ├── rare.toml
│ │ │ ├── uncommon.toml
│ │ │ └── verycommon.toml
│ │ └── memmem/
│ │ ├── byterank.toml
│ │ ├── code.toml
│ │ ├── pathological.toml
│ │ ├── sliceslice.toml
│ │ └── subtitles/
│ │ ├── common.toml
│ │ ├── never.toml
│ │ └── rare.toml
│ ├── engines/
│ │ ├── .gitignore
│ │ ├── libc/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-bytecount/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-jetscii/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-memchr/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-memchrold/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-sliceslice/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-std/
│ │ │ ├── Cargo.toml
│ │ │ ├── build.rs
│ │ │ └── main.rs
│ │ └── stringzilla/
│ │ ├── Cargo.toml
│ │ └── main.rs
│ ├── engines.toml
│ ├── haystacks/
│ │ ├── README.md
│ │ ├── code/
│ │ │ ├── README.md
│ │ │ └── rust-library.rs
│ │ ├── opensubtitles/
│ │ │ ├── README.md
│ │ │ ├── en-huge.txt
│ │ │ ├── en-medium.txt
│ │ │ ├── en-small.txt
│ │ │ ├── en-teeny.txt
│ │ │ ├── en-tiny.txt
│ │ │ ├── ru-huge.txt
│ │ │ ├── ru-medium.txt
│ │ │ ├── ru-small.txt
│ │ │ ├── ru-teeny.txt
│ │ │ ├── ru-tiny.txt
│ │ │ ├── zh-huge.txt
│ │ │ ├── zh-medium.txt
│ │ │ ├── zh-small.txt
│ │ │ ├── zh-teeny.txt
│ │ │ └── zh-tiny.txt
│ │ ├── pathological/
│ │ │ ├── README.md
│ │ │ ├── defeat-simple-vector-freq.txt
│ │ │ ├── defeat-simple-vector-repeated.txt
│ │ │ ├── defeat-simple-vector.txt
│ │ │ ├── md5-huge.txt
│ │ │ ├── random-huge.txt
│ │ │ ├── repeated-rare-huge.txt
│ │ │ └── repeated-rare-small.txt
│ │ ├── rg-13.0.0.txt
│ │ ├── sherlock/
│ │ │ ├── README.md
│ │ │ ├── huge.txt
│ │ │ ├── small.txt
│ │ │ └── tiny.txt
│ │ └── sliceslice/
│ │ ├── README.md
│ │ ├── haystack.txt
│ │ ├── i386-notutf8.txt
│ │ └── i386.txt
│ ├── record/
│ │ ├── aarch64/
│ │ │ ├── 2023-08-17.csv
│ │ │ ├── 2023-08-20.csv
│ │ │ ├── 2023-08-24.csv
│ │ │ ├── 2023-08-24_2.csv
│ │ │ ├── 2023-08-26.csv
│ │ │ ├── 2023-08-27.csv
│ │ │ └── 2023-12-29.csv
│ │ └── x86_64/
│ │ ├── 2023-07-31_baseline.csv
│ │ ├── 2023-08-07.csv
│ │ ├── 2023-08-09.csv
│ │ ├── 2023-08-15.csv
│ │ ├── 2023-08-17.csv
│ │ ├── 2023-08-20.csv
│ │ ├── 2023-08-23.csv
│ │ ├── 2023-08-24.csv
│ │ ├── 2023-08-24_2.csv
│ │ ├── 2023-08-25.csv
│ │ ├── 2023-08-26.csv
│ │ ├── 2023-08-27.csv
│ │ ├── 2023-12-29.csv
│ │ └── 2025-09-25.csv
│ ├── regexes/
│ │ ├── sliceslice/
│ │ │ ├── README.md
│ │ │ ├── words-by-length-desc.txt
│ │ │ └── words.txt
│ │ └── zero-zero-dd-dd.txt
│ └── shared/
│ ├── Cargo.toml
│ └── lib.rs
├── fuzz/
│ ├── .gitignore
│ ├── Cargo.toml
│ └── fuzz_targets/
│ ├── memchr.rs
│ ├── memchr2.rs
│ ├── memchr3.rs
│ ├── memmem.rs
│ ├── memrchr.rs
│ ├── memrchr2.rs
│ ├── memrchr3.rs
│ └── memrmem.rs
├── rustfmt.toml
├── scripts/
│ └── make-byte-frequency-table
└── src/
├── arch/
│ ├── aarch64/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── neon/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── packedpair.rs
│ ├── all/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ ├── packedpair/
│ │ │ ├── default_rank.rs
│ │ │ └── mod.rs
│ │ ├── rabinkarp.rs
│ │ ├── shiftor.rs
│ │ └── twoway.rs
│ ├── generic/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── packedpair.rs
│ ├── mod.rs
│ ├── wasm32/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── simd128/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── packedpair.rs
│ └── x86_64/
│ ├── avx2/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── packedpair.rs
│ ├── memchr.rs
│ ├── mod.rs
│ └── sse2/
│ ├── memchr.rs
│ ├── mod.rs
│ └── packedpair.rs
├── cow.rs
├── ext.rs
├── lib.rs
├── macros.rs
├── memchr.rs
├── memmem/
│ ├── mod.rs
│ └── searcher.rs
├── tests/
│ ├── memchr/
│ │ ├── mod.rs
│ │ ├── naive.rs
│ │ └── prop.rs
│ ├── mod.rs
│ ├── packedpair.rs
│ └── substring/
│ ├── mod.rs
│ ├── naive.rs
│ └── prop.rs
└── vector.rs
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/FUNDING.yml
================================================
github: [BurntSushi]
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: semiannually
open-pull-requests-limit: 1
cooldown:
default-days: 30
groups:
actions:
patterns:
- "*"
================================================
FILE: .github/workflows/ci.yml
================================================
name: ci
on:
pull_request:
branches:
- master
push:
branches:
- master
schedule:
- cron: '00 01 * * *'
# The section is needed to drop write-all permissions that are granted on
# `schedule` event. By specifying any permission explicitly all others are set
# to none. By using the principle of least privilege the damage a compromised
# workflow can do (because of an injection or compromised third party tool or
# action) is restricted. Currently the worklow doesn't need any additional
# permission except for pulling the code. Adding labels to issues, commenting
# on pull-requests, etc. may need additional permissions:
#
# Syntax for this section:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
#
# Reference for how to assign permissions on a job-by-job basis:
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
#
# Reference for available permissions that we can enable if needed:
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
permissions:
# to fetch code (actions/checkout)
contents: read
jobs:
# Baseline testing across a number of different targets.
test:
env:
# For some builds, we use cross to test on 32-bit and big-endian
# systems.
CARGO: cargo
# When CARGO is set to CROSS, TARGET is set to `--target matrix.target`.
# Note that we only use cross on Linux, so setting a target on a
# different OS will just use normal cargo.
TARGET:
# Bump this as appropriate. We pin to a version to make sure CI
# continues to work as cross releases in the past have broken things
# in subtle ways.
CROSS_VERSION: v0.2.5
# Make quickcheck run more tests for hopefully better coverage.
QUICKCHECK_TESTS: 100000
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- build: stable
os: ubuntu-latest
rust: stable
- build: beta
os: ubuntu-latest
rust: beta
- build: nightly
os: ubuntu-latest
rust: nightly
- build: macos
os: macos-latest
rust: stable
- build: win-msvc
os: windows-latest
rust: stable
- build: win-gnu
os: windows-latest
rust: stable-x86_64-gnu
- build: stable-x86
os: ubuntu-latest
rust: stable
target: i686-unknown-linux-gnu
# This is kind of a stand-in for Apple silicon since we can't currently
# use GitHub Actions with Apple silicon.
- build: stable-aarch64
os: ubuntu-latest
rust: stable
target: aarch64-unknown-linux-gnu
- build: stable-powerpc64
os: ubuntu-latest
rust: stable
target: powerpc64-unknown-linux-gnu
- build: stable-s390x
os: ubuntu-latest
rust: stable
target: s390x-unknown-linux-gnu
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: ${{ matrix.rust }}
- name: Use Cross
if: matrix.os == 'ubuntu-latest' && matrix.target != ''
run: |
# In the past, new releases of 'cross' have broken CI. So for now, we
# pin it. We also use their pre-compiled binary releases because cross
# has over 100 dependencies and takes a bit to compile.
dir="$RUNNER_TEMP/cross-download"
mkdir "$dir"
echo "$dir" >> $GITHUB_PATH
cd "$dir"
curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz"
tar xf cross-x86_64-unknown-linux-musl.tar.gz
echo "CARGO=cross" >> $GITHUB_ENV
echo "TARGET=--target ${{ matrix.target }}" >> $GITHUB_ENV
- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET }}"
- name: Show CPU info for debugging
if: matrix.os == 'ubuntu-latest'
run: lscpu
- name: Basic build
run: ${{ env.CARGO }} build --verbose $TARGET
- name: Build docs
run: ${{ env.CARGO }} doc --verbose $TARGET
- name: Show byte order for debugging
run: ${{ env.CARGO }} test --verbose $TARGET byte_order -- --nocapture
- name: Run tests
run: ${{ env.CARGO }} test --verbose
- name: Run with only 'alloc' enabled
run: ${{ env.CARGO }} test --verbose --no-default-features --features alloc
- name: Run tests without any features enabled (core-only)
run: ${{ env.CARGO }} test --verbose --no-default-features
- name: Run tests with miscellaneous features
run: ${{ env.CARGO }} test --verbose --features logging
# Setup and run tests on the wasm32-wasip1 target via wasmtime.
wasm:
runs-on: ubuntu-latest
env:
# The version of wasmtime to download and install.
WASMTIME_VERSION: 30.0.1
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
- name: Add wasm32-wasip1 target
run: rustup target add wasm32-wasip1
- name: Download and install Wasmtime
run: |
echo "CARGO_BUILD_TARGET=wasm32-wasip1" >> $GITHUB_ENV
echo "RUSTFLAGS=-Ctarget-feature=+simd128" >> $GITHUB_ENV
curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v$WASMTIME_VERSION/wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz
tar xvf wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz
echo `pwd`/wasmtime-v$WASMTIME_VERSION-x86_64-linux >> $GITHUB_PATH
echo "CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime run --wasm simd --" >> $GITHUB_ENV
- name: Basic build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run with only 'alloc' enabled
run: cargo test --verbose --no-default-features --features alloc
- name: Run tests without any features enabled (core-only)
run: cargo test --verbose --no-default-features
# Setup and run tests on the wasm32-wasip1 target via wasmtime, but without
# simd128 enabled.
wasm-no-simd128:
runs-on: ubuntu-latest
env:
# The version of wasmtime to download and install.
WASMTIME_VERSION: 30.0.1
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
- name: Add wasm32-wasip1 target
run: rustup target add wasm32-wasip1
- name: Download and install Wasmtime
run: |
echo "CARGO_BUILD_TARGET=wasm32-wasip1" >> $GITHUB_ENV
echo "RUSTFLAGS=-Ctarget-feature=-simd128" >> $GITHUB_ENV
curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v$WASMTIME_VERSION/wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz
tar xvf wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz
echo `pwd`/wasmtime-v$WASMTIME_VERSION-x86_64-linux >> $GITHUB_PATH
echo "CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime run --" >> $GITHUB_ENV
- name: Basic build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run with only 'alloc' enabled
run: cargo test --verbose --no-default-features --features alloc
- name: Run tests without any features enabled (core-only)
run: cargo test --verbose --no-default-features
# This job uses a target to build the memchr crate on x86-64 but *without*
# SSE/AVX target features. This is relevant for virtually all OS kernels.
build-for-x86-64-but-non-sse-target:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
targets: x86_64-unknown-none
- name: Build for x86_64-unknown-none with only 'alloc' enabled
run: cargo build --verbose --no-default-features --features alloc --target x86_64-unknown-none
- name: Run tests for x86_64-unknown-linux-gnu without SSE
run: cargo test --verbose
env:
RUSTFLAGS: -C target-feature=-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float
- name: Run tests for x86_64-unknown-linux-gnu without SSE with only 'alloc' enabled
run: cargo test --verbose --no-default-features --features alloc
env:
RUSTFLAGS: -C target-feature=-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float
# This job runs a stripped down version of CI to test the MSRV. The specific
# reason for doing this is that dev-dependencies tend to evolve more quickly.
# There isn't as tight of a control on them because, well, they're only used
# in tests and their MSRV doesn't matter as much.
#
# It is a bit unfortunate that our MSRV test is basically just "build it"
# and pass if that works. But usually MSRV is broken by compilation problems
# and not runtime behavior. So this is in practice good enough.
msrv:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: 1.61.0
- name: Basic build
run: cargo build --verbose
- name: Build docs
run: cargo doc --verbose
# Runs miri on memchr's test suite. This doesn't quite cover everything. Some
# tests (especially quickcheck) are disabled when building with miri because
# of how slow miri runs. But it still gives us decent coverage.
miri:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
# We use nightly here so that we can use miri I guess?
toolchain: nightly
components: miri
- name: Run full test suite
run: cargo miri test --verbose
# Tests that memchr's benchmark suite builds and passes all tests.
rebar:
runs-on: ubuntu-latest
env:
# The version of wasmtime to download and install.
WASMTIME_VERSION: 30.0.1
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
- name: Add wasm32-wasip1 target
run: rustup target add wasm32-wasip1
- name: Download and install Wasmtime
run: |
# Note that we don't have to set CARGO_BUILD_TARGET and other
# environment variables like we do for the `wasm` job. This is because
# `rebar` knows how to set them itself and only when running the wasm
# engines.
curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v$WASMTIME_VERSION/wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz
tar xvf wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz
echo `pwd`/wasmtime-v$WASMTIME_VERSION-x86_64-linux >> $GITHUB_PATH
- name: Install rebar
run: cargo install --git https://github.com/BurntSushi/rebar rebar
- name: Build all rebar engines
run: rebar build
- name: Run all benchmarks as tests
run: rebar measure --test
# Tests that everything is formatted correctly.
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
with:
toolchain: stable
components: rustfmt
- name: Check formatting
run: |
cargo fmt --all -- --check
================================================
FILE: .gitignore
================================================
.*.swp
doc
tags
examples/ss10pusa.csv
build
target
Cargo.lock
scratch*
bench_large/huge
tmp/
================================================
FILE: .ignore
================================================
!.github
================================================
FILE: .vim/coc-settings.json
================================================
{
"rust-analyzer.cargo.allFeatures": false,
"rust-analyzer.linkedProjects": [
"benchmarks/engines/libc/Cargo.toml",
"benchmarks/engines/rust-bytecount/Cargo.toml",
"benchmarks/engines/rust-jetscii/Cargo.toml",
"benchmarks/engines/rust-memchr/Cargo.toml",
"benchmarks/engines/rust-memchrold/Cargo.toml",
"benchmarks/engines/rust-sliceslice/Cargo.toml",
"benchmarks/engines/rust-std/Cargo.toml",
"benchmarks/engines/stringzilla/Cargo.toml",
"benchmarks/shared/Cargo.toml",
"fuzz/Cargo.toml",
"Cargo.toml"
]
}
================================================
FILE: COPYING
================================================
This project is dual-licensed under the Unlicense and MIT licenses.
You may use this code under the terms of either license.
================================================
FILE: Cargo.toml
================================================
[package]
name = "memchr"
version = "2.8.0" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>", "bluss"]
description = """
Provides extremely fast (uses SIMD on x86_64, aarch64 and wasm32) routines for
1, 2 or 3 byte search and single substring search.
"""
documentation = "https://docs.rs/memchr/"
homepage = "https://github.com/BurntSushi/memchr"
repository = "https://github.com/BurntSushi/memchr"
readme = "README.md"
keywords = ["memchr", "memmem", "substring", "find", "search"]
license = "Unlicense OR MIT"
exclude = ["/.github", "/benchmarks", "/fuzz", "/scripts", "/tmp"]
edition = "2021"
rust-version = "1.61"
[lib]
name = "memchr"
bench = false
[features]
default = ["std"]
# The 'std' feature permits the memchr crate to use the standard library. This
# permits this crate to use runtime CPU feature detection to automatically
# accelerate searching via vector instructions. Without the standard library,
# this automatic detection is not possible.
std = ["alloc"]
# The 'alloc' feature enables some APIs that require allocation, such as
# 'Finder::into_owned'. Note that this feature does not enable runtime CPU
# feature detection. That still requires 'std'.
alloc = []
# When enabled (it's disabled by default), the `log` crate will be used to
# emit a spattering of log messages. For the most part, the log messages are
# meant to indicate what strategies are being employed. For example, whether
# a vector or a scalar algorithm is used for substring search. This can be
# useful when debugging performance problems.
#
# This is disabled by default.
logging = ["dep:log"]
# The 'use_std' feature is DEPRECATED. It will be removed in memchr 3. Until
# then, it is alias for the 'std' feature.
use_std = ["std"]
# The 'libc' feature has been DEPRECATED and no longer has any effect.
libc = []
# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
rustc-dep-of-std = ['core']
[dependencies]
# Only used when the `logging` feature is enabled (disabled by default).
log = { version = "0.4.20", optional = true }
# Internal feature, only used when building as part of libstd, not part of the
# stable interface of this crate.
core = { version = '1.0.0', optional = true, package = 'rustc-std-workspace-core' }
[dev-dependencies]
quickcheck = { version = "1.0.3", default-features = false }
[profile.release]
debug = true
[profile.bench]
debug = true
[profile.test]
opt-level = 3
debug = true
[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]
================================================
FILE: LICENSE-MIT
================================================
The MIT License (MIT)
Copyright (c) 2015 Andrew Gallant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: README.md
================================================
memchr
======
This library provides heavily optimized routines for string search primitives.
[](https://github.com/BurntSushi/memchr/actions)
[](https://crates.io/crates/memchr)
Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
### Documentation
[https://docs.rs/memchr](https://docs.rs/memchr)
### Overview
* The top-level module provides routines for searching for 1, 2 or 3 bytes
in the forward or reverse direction. When searching for more than one byte,
positions are considered a match if the byte at that position matches any
of the bytes.
* The `memmem` sub-module provides forward and reverse substring search
routines.
In all such cases, routines operate on `&[u8]` without regard to encoding. This
is exactly what you want when searching either UTF-8 or arbitrary bytes.
### Compiling without the standard library
memchr links to the standard library by default, but you can disable the
`std` feature if you want to use it in a `#![no_std]` crate:
```toml
[dependencies]
memchr = { version = "2", default-features = false }
```
On `x86_64` platforms, when the `std` feature is disabled, the SSE2 accelerated
implementations will be used. When `std` is enabled, AVX2 accelerated
implementations will be used if the CPU is determined to support it at runtime.
SIMD accelerated routines are also available on the `wasm32` and `aarch64`
targets. The `std` feature is not required to use them.
When a SIMD version is not available, then this crate falls back to
[SWAR](https://en.wikipedia.org/wiki/SWAR) techniques.
### Minimum Rust version policy
This crate's minimum supported `rustc` version is `1.61.0`.
The current policy is that the minimum Rust version required to use this crate
can be increased in minor version updates. For example, if `crate 1.0` requires
Rust 1.20.0, then `crate 1.0.z` for all values of `z` will also require Rust
1.20.0 or newer. However, `crate 1.y` for `y > 0` may require a newer minimum
version of Rust.
In general, this crate will be conservative with respect to the minimum
supported version of Rust.
### Testing strategy
Given the complexity of the code in this crate, along with the pervasive use
of `unsafe`, this crate has an extensive testing strategy. It combines multiple
approaches:
* Hand-written tests.
* Exhaustive-style testing meant to exercise all possible branching and offset
calculations.
* Property based testing through [`quickcheck`](https://github.com/BurntSushi/quickcheck).
* Fuzz testing through [`cargo fuzz`](https://github.com/rust-fuzz/cargo-fuzz).
* A huge suite of benchmarks that are also run as tests. Benchmarks always
confirm that the expected result occurs.
Improvements to the testing infrastructure are very welcome.
### Algorithms used
At time of writing, this crate's implementation of substring search actually
has a few different algorithms to choose from depending on the situation.
* For very small haystacks,
[Rabin-Karp](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm)
is used to reduce latency. Rabin-Karp has very small overhead and can often
complete before other searchers have even been constructed.
* For small needles, a variant of the
["Generic SIMD"](http://0x80.pl/articles/simd-strfind.html#algorithm-1-generic-simd)
algorithm is used. Instead of using the first and last bytes, a heuristic is
used to select bytes based on a background distribution of byte frequencies.
* In all other cases,
[Two-Way](https://en.wikipedia.org/wiki/Two-way_string-matching_algorithm)
is used. If possible, a prefilter based on the "Generic SIMD" algorithm
linked above is used to find candidates quickly. A dynamic heuristic is used
to detect if the prefilter is ineffective, and if so, disables it.
### Why is the standard library's substring search so much slower?
We'll start by establishing what the difference in performance actually
is. There are two relevant benchmark classes to consider: `prebuilt` and
`oneshot`. The `prebuilt` benchmarks are designed to measure---to the extent
possible---search time only. That is, the benchmark first starts by building a
searcher and then only tracking the time for _using_ the searcher:
```
$ rebar rank benchmarks/record/x86_64/2023-08-26.csv --intersection -e memchr/memmem/prebuilt -e std/memmem/prebuilt
Engine Version Geometric mean of speed ratios Benchmark count
------ ------- ------------------------------ ---------------
rust/memchr/memmem/prebuilt 2.5.0 1.03 53
rust/std/memmem/prebuilt 1.73.0-nightly 180dffba1 6.50 53
```
Conversely, the `oneshot` benchmark class measures the time it takes to both
build the searcher _and_ use it:
```
$ rebar rank benchmarks/record/x86_64/2023-08-26.csv --intersection -e memchr/memmem/oneshot -e std/memmem/oneshot
Engine Version Geometric mean of speed ratios Benchmark count
------ ------- ------------------------------ ---------------
rust/memchr/memmem/oneshot 2.5.0 1.04 53
rust/std/memmem/oneshot 1.73.0-nightly 180dffba1 5.26 53
```
**NOTE:** Replace `rebar rank` with `rebar cmp` in the above commands to
explore the specific benchmarks and their differences.
So in both cases, this crate is quite a bit faster over a broad sampling of
benchmarks regardless of whether you measure only search time or search time
plus construction time. The difference is a little smaller when you include
construction time in your measurements.
These two different types of benchmark classes make for a nice segue into
one reason why the standard library's substring search can be slower: API
design. In the standard library, the only APIs available to you require
one to re-construct the searcher for every search. While you can benefit
from building a searcher once and iterating over all matches in a single
string, you cannot reuse that searcher to search other strings. This might
come up when, for example, searching a file one line at a time. You'll need
to re-build the searcher for every line searched, and this can [really
matter][burntsushi-bstr-blog].
**NOTE:** The `prebuilt` benchmark for the standard library can't actually
avoid measuring searcher construction at some level, because there is no API
for it. Instead, the benchmark consists of building the searcher once and then
finding all matches in a single string via an iterator. This tends to
approximate a benchmark where searcher construction isn't measured, but it
isn't perfect. While this means the comparison is not strictly
apples-to-apples, it does reflect what is maximally possible with the standard
library, and thus reflects the best that one could do in a real world scenario.
While there is more to the story than just API design here, it's important to
point out that even if the standard library's substring search were a precise
clone of this crate internally, it would still be at a disadvantage in some
workloads because of its API. (The same also applies to C's standard library
`memmem` function. There is no way to amortize construction of the searcher.
You need to pay for it on every call.)
The other reason for the difference in performance is that
the standard library has trouble using SIMD. In particular, substring search
is implemented in the `core` library, where platform specific code generally
can't exist. That's an issue because in order to utilize SIMD beyond SSE2
while maintaining portable binaries, one needs to use [dynamic CPU feature
detection][dynamic-cpu], and that in turn requires platform specific code.
While there is [an RFC for enabling target feature detection in
`core`][core-feature], it doesn't yet exist.
The bottom line here is that `core`'s substring search implementation is
limited to making use of SSE2, but not AVX.
Still though, this crate does accelerate substring search even when only SSE2
is available. The standard library could therefore adopt the techniques in this
crate just for SSE2. The reason why that hasn't happened yet isn't totally
clear to me. It likely needs a champion to push it through. The standard
library tends to be more conservative in these things. With that said, the
standard library does use some [SSE2 acceleration on `x86-64`][std-sse2] added
in [this PR][std-sse2-pr]. However, at the time of writing, it is only used
for short needles and doesn't use the frequency based heuristics found in this
crate.
**NOTE:** Another thing worth mentioning is that the standard library's
substring search routine requires that both the needle and haystack have type
`&str`. Unless you can assume that your data is valid UTF-8, building a `&str`
will come with the overhead of UTF-8 validation. This may in turn result in
overall slower searching depending on your workload. In contrast, the `memchr`
crate permits both the needle and the haystack to have type `&[u8]`, where
`&[u8]` can be created from a `&str` with zero cost. Therefore, the substring
search in this crate is strictly more flexible than what the standard library
provides.
[burntsushi-bstr-blog]: https://blog.burntsushi.net/bstr/#motivation-based-on-performance
[dynamic-cpu]: https://doc.rust-lang.org/std/arch/index.html#dynamic-cpu-feature-detection
[core-feature]: https://github.com/rust-lang/rfcs/pull/3469
[std-sse2]: https://github.com/rust-lang/rust/blob/bf9229a2e366b4c311f059014a4aa08af16de5d8/library/core/src/str/pattern.rs#L1719-L1857
[std-sse2-pr]: https://github.com/rust-lang/rust/pull/103779
================================================
FILE: UNLICENSE
================================================
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
================================================
FILE: benchmarks/definitions/memchr/sherlock/common.toml
================================================
[[bench]]
model = "count-bytes"
name = "huge1"
regex = 'a'
haystack = { path = "sherlock/huge.txt" }
count = 35_301
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "huge2"
regex = ['a', 't']
haystack = { path = "sherlock/huge.txt" }
count = 74_569
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "huge3"
regex = ['a', 't', 'o']
haystack = { path = "sherlock/huge.txt" }
count = 109_064
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "small1"
regex = 'a'
haystack = { path = "sherlock/small.txt" }
count = 44
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "small2"
regex = ['a', 'h']
haystack = { path = "sherlock/small.txt" }
count = 78
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "small3"
regex = ['a', 'h', 'i']
haystack = { path = "sherlock/small.txt" }
count = 113
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "tiny1"
regex = ' '
haystack = { path = "sherlock/tiny.txt" }
count = 11
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
================================================
FILE: benchmarks/definitions/memchr/sherlock/never.toml
================================================
[[bench]]
model = "count-bytes"
name = "huge1"
regex = '<'
haystack = { path = "sherlock/huge.txt" }
count = 0
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "huge2"
regex = ['<', '>']
haystack = { path = "sherlock/huge.txt" }
count = 0
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "huge3"
regex = ['<', '>', '=']
haystack = { path = "sherlock/huge.txt" }
count = 0
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "small1"
regex = '<'
haystack = { path = "sherlock/small.txt" }
count = 0
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "small2"
regex = ['<', '>']
haystack = { path = "sherlock/small.txt" }
count = 0
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "small3"
regex = ['<', '>', '=']
haystack = { path = "sherlock/small.txt" }
count = 0
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "tiny1"
regex = '<'
haystack = { path = "sherlock/tiny.txt" }
count = 0
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "tiny2"
regex = ['<', '>']
haystack = { path = "sherlock/tiny.txt" }
count = 0
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "tiny3"
regex = ['<', '>', '=']
haystack = { path = "sherlock/tiny.txt" }
count = 0
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "empty1"
regex = '<'
haystack = ''
count = 0
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "empty2"
regex = ['<', '>']
haystack = ''
count = 0
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "empty3"
regex = ['<', '>', '=']
haystack = ''
count = 0
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
================================================
FILE: benchmarks/definitions/memchr/sherlock/rare.toml
================================================
[[bench]]
model = "count-bytes"
name = "huge1"
regex = 'z'
haystack = { path = "sherlock/huge.txt" }
count = 151
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "huge2"
regex = ['z', 'R']
haystack = { path = "sherlock/huge.txt" }
count = 426
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "huge3"
regex = ['z', 'R', 'J']
haystack = { path = "sherlock/huge.txt" }
count = 546
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "small1"
regex = 'R'
haystack = { path = "sherlock/small.txt" }
count = 1
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "small2"
regex = ['R', 'P']
haystack = { path = "sherlock/small.txt" }
count = 2
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "small3"
regex = ['R', 'P', 'T']
haystack = { path = "sherlock/small.txt" }
count = 3
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "tiny1"
regex = '.'
haystack = { path = "sherlock/tiny.txt" }
count = 1
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "tiny2"
regex = ['.', 'H']
haystack = { path = "sherlock/tiny.txt" }
count = 2
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "tiny3"
regex = ['.', 'H', 'M']
haystack = { path = "sherlock/tiny.txt" }
count = 3
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
================================================
FILE: benchmarks/definitions/memchr/sherlock/uncommon.toml
================================================
[[bench]]
model = "count-bytes"
name = "huge1"
regex = 'b'
haystack = { path = "sherlock/huge.txt" }
count = 6124
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "huge2"
regex = ['b', 'p']
haystack = { path = "sherlock/huge.txt" }
count = 13_113
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "huge3"
regex = ['b', 'p', '.']
haystack = { path = "sherlock/huge.txt" }
count = 19_538
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "small1"
regex = 'b'
haystack = { path = "sherlock/small.txt" }
count = 8
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "small2"
regex = ['b', 'g']
haystack = { path = "sherlock/small.txt" }
count = 16
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "small3"
regex = ['b', 'g', 'p']
haystack = { path = "sherlock/small.txt" }
count = 24
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
[[bench]]
model = "count-bytes"
name = "tiny1"
regex = 'l'
haystack = { path = "sherlock/tiny.txt" }
count = 5
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "tiny2"
regex = ['l', 's']
haystack = { path = "sherlock/tiny.txt" }
count = 10
engines = [
"rust/memchr/memchr2",
"rust/memchr/memchr2/fallback",
"rust/memchr/memchr2/naive",
"rust/memchr/memchr2/wasm32",
"rust/memchr/memrchr2",
"rust/memchrold/memchr2",
"rust/memchrold/memrchr2",
]
[[bench]]
model = "count-bytes"
name = "tiny3"
regex = ['l', 's', 'e']
haystack = { path = "sherlock/tiny.txt" }
count = 16
engines = [
"rust/memchr/memchr3",
"rust/memchr/memchr3/fallback",
"rust/memchr/memchr3/naive",
"rust/memchr/memchr3/wasm32",
"rust/memchr/memrchr3",
"rust/memchrold/memchr3",
"rust/memchrold/memrchr3",
]
================================================
FILE: benchmarks/definitions/memchr/sherlock/verycommon.toml
================================================
[[bench]]
model = "count-bytes"
name = "huge1"
regex = ' '
haystack = { path = "sherlock/huge.txt" }
count = 97_626
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
[[bench]]
model = "count-bytes"
name = "small1"
regex = ' '
haystack = { path = "sherlock/small.txt" }
count = 106
engines = [
"libc/memchr/oneshot",
"rust/bytecount/memchr/oneshot",
"rust/bytecount/memchr/oneshot/wasm32",
"rust/memchr/memchr/onlycount",
"rust/memchr/memchr/onlycount/wasm32",
"rust/memchr/memchr/oneshot",
"rust/memchr/memchr/prebuilt",
"rust/memchr/memchr/fallback",
"rust/memchr/memchr/naive",
"rust/memchr/memchr/wasm32",
"rust/memchr/memrchr",
"rust/memchrold/memchr/oneshot",
"rust/memchrold/memchr/prebuilt",
"rust/memchrold/memchr/naive",
"rust/memchrold/memrchr",
]
================================================
FILE: benchmarks/definitions/memmem/byterank.toml
================================================
[[bench]]
model = "count"
name = "binary"
regex = '\x00\x00\xDD\xDD\x00'
haystack = { path = "rg-13.0.0.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/binary",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
analysis = '''
This benchmark demonstrates the utility of using one's own heuristic ranking
function for the background frequency of bytes. In this case, the needle has
NUL bytes which are quite uncommon in plain text but common in binary data.
Since the heuristics in the `memchr` crate are more or less targeted at plain
text, the NUL byte is chosen as a predicate because it is believed to be rare.
But since the haystack is an executable, i.e. binary data, this choice is poor.
So this measures a separate engine, `rust/memchr/memmem/binary`, which is like
`rust/memchr/memmem/prebuilt`, except it uses a ranking function tuned from
binary data. In this case, the NUL byte is considered common and thus not used
as a predicate. This leads to a dramatic improvement in throughput.
'''
================================================
FILE: benchmarks/definitions/memmem/code.toml
================================================
[[bench]]
model = "count"
name = "rust-library-never-fn-strength"
regex = 'fn strength'
haystack = { path = "code/rust-library.rs" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rust-library-never-fn-strength-paren"
regex = 'fn strength('
haystack = { path = "code/rust-library.rs" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rust-library-never-fn-quux"
regex = 'fn quux('
haystack = { path = "code/rust-library.rs" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rust-library-rare-fn-from-str"
regex = 'pub fn from_str('
haystack = { path = "code/rust-library.rs" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rust-library-common-fn-is-empty"
regex = 'fn is_empty'
haystack = { path = "code/rust-library.rs" }
count = 17
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rust-library-common-fn"
regex = 'fn'
haystack = { path = "code/rust-library.rs" }
count = 2985
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rust-library-common-paren"
regex = '('
haystack = { path = "code/rust-library.rs" }
count = 30_193
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rust-library-common-let"
regex = 'let'
haystack = { path = "code/rust-library.rs" }
count = 4737
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
================================================
FILE: benchmarks/definitions/memmem/pathological.toml
================================================
[[bench]]
model = "count"
name = "md5-huge-no-hash"
regex = '61a1a40effcf97de24505f154a306597'
haystack = { path = "pathological/md5-huge.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "md5-huge-last-hash"
regex = '831df319d8597f5bc793d690f08b159b'
haystack = { path = "pathological/md5-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rare-repeated-huge-tricky"
regex = 'abczdef'
haystack = { path = "pathological/repeated-rare-huge.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rare-repeated-huge-match"
regex = 'zzzzzzzzzz'
haystack = { path = "pathological/repeated-rare-huge.txt" }
count = 50_010
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rare-repeated-small-tricky"
regex = 'abczdef'
haystack = { path = "pathological/repeated-rare-small.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "rare-repeated-small-match"
regex = 'zzzzzzzzzz'
haystack = { path = "pathological/repeated-rare-small.txt" }
count = 100
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "defeat-simple-vector-alphabet"
regex = 'qbz'
haystack = { path = "pathological/defeat-simple-vector.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "defeat-simple-vector-freq-alphabet"
regex = 'qjaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz'
haystack = { path = "pathological/defeat-simple-vector-freq.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "defeat-simple-vector-repeated-alphabet"
regex = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzaz'
haystack = { path = "pathological/defeat-simple-vector-repeated.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
================================================
FILE: benchmarks/definitions/memmem/sliceslice.toml
================================================
analysis = '''
These benchmarks were lifted almost verbtaim out of the sliceslice crate. The
reason why we have these benchmarks is because they were the primary thing
that motivated me to write the memmem implementation in the `memchr` crate. In
particular, my existing substring search implementation in the `bstr` crate
did quite poorly on these particular benchmarks. Moreover, while the benchmark
setup is a little weird, these benchmarks do reflect cases that I think are
somewhat common:
* In the sliceslice-words/words case, the benchmark is primarily about
searching very short haystacks using common English words.
* In the sliceslice-words/i386 case, the benchmark is primarily about searching
a longer haystack with common English words.
N.B. In the sliceslice crate, the benchmarks are called "short" and "long."
Here, we call them sliceslice-words/words and sliceslice-i386/words,
respectively. The name change was made to be consistent with the naming
convention used for other benchmarks.
The main thing that's "weird" about these benchmarks is that each iteration
involves a lot of work. All of the other benchmarks in this crate focus on one
specific needle with one specific haystack, and each iteration is a single
search or iteration. But in these benchmarks, each iteration involves searching
with many needles against potentially many haystacks. Nevertheless, these have
proven useful targets for optimization.
'''
[[bench]]
model = "needles-in-needles"
name = "short"
regex = { path = "sliceslice/words-by-length-desc.txt", per-line = "pattern" }
haystack = '' # not used in this model
count = 4585
engines = [
"rust/memchr/memmem/prebuilt",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/prebuilt",
]
[[bench]]
model = "needles-in-haystack"
name = "seemingly-random"
regex = { path = "sliceslice/words-by-length-desc.txt", per-line = "pattern" }
haystack = { path = "sliceslice/haystack.txt" }
count = 106
engines = [
"rust/memchr/memmem/prebuilt",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/prebuilt",
]
[[bench]]
model = "needles-in-haystack"
name = "i386"
regex = { path = "sliceslice/words-by-length-desc.txt", per-line = "pattern" }
haystack = { path = "sliceslice/i386.txt" }
count = 4585
engines = [
"rust/memchr/memmem/prebuilt",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/prebuilt",
]
================================================
FILE: benchmarks/definitions/memmem/subtitles/common.toml
================================================
[[bench]]
model = "count"
name = "huge-en-that"
regex = 'that'
haystack = { path = "opensubtitles/en-huge.txt" }
count = 865
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-you"
regex = 'you'
haystack = { path = "opensubtitles/en-huge.txt" }
count = 5009
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-one-space"
regex = ' '
haystack = { path = "opensubtitles/en-huge.txt" }
count = 96_606
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-ru-that"
regex = 'что'
haystack = { path = "opensubtitles/ru-huge.txt" }
count = 998
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-ru-not"
regex = 'не'
haystack = { path = "opensubtitles/ru-huge.txt" }
count = 3092
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-ru-one-space"
regex = ' '
haystack = { path = "opensubtitles/ru-huge.txt" }
count = 46_941
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-zh-that"
regex = '那'
haystack = { path = "opensubtitles/zh-huge.txt" }
count = 1056
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-zh-do-not"
regex = '不'
haystack = { path = "opensubtitles/zh-huge.txt" }
count = 2751
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-zh-one-space"
regex = ' '
haystack = { path = "opensubtitles/zh-huge.txt" }
count = 17_232
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
================================================
FILE: benchmarks/definitions/memmem/subtitles/never.toml
================================================
[[bench]]
model = "count"
name = "huge-en-john-watson"
regex = 'John Watson'
haystack = { path = "opensubtitles/en-huge.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-all-common-bytes"
regex = 'sternness'
haystack = { path = "opensubtitles/en-huge.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-some-rare-bytes"
regex = 'quartz'
haystack = { path = "opensubtitles/en-huge.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-two-space"
regex = ' '
haystack = { path = "opensubtitles/en-huge.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-en-john-watson"
regex = 'John Watson'
haystack = { path = "opensubtitles/en-teeny.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-en-all-common-bytes"
regex = 'sternness'
haystack = { path = "opensubtitles/en-teeny.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-en-some-rare-bytes"
regex = 'quartz'
haystack = { path = "opensubtitles/en-teeny.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-en-two-space"
regex = ' '
haystack = { path = "opensubtitles/en-teeny.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-ru-john-watson"
regex = 'Джон Уотсон'
haystack = { path = "opensubtitles/ru-huge.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-ru-john-watson"
regex = 'Джон Уотсон'
haystack = { path = "opensubtitles/ru-teeny.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-zh-john-watson"
regex = '约翰·沃森'
haystack = { path = "opensubtitles/zh-huge.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-zh-john-watson"
regex = '约翰·沃森'
haystack = { path = "opensubtitles/zh-teeny.txt" }
count = 0
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
================================================
FILE: benchmarks/definitions/memmem/subtitles/rare.toml
================================================
[[bench]]
model = "count"
name = "huge-en-sherlock-holmes"
regex = 'Sherlock Holmes'
haystack = { path = "opensubtitles/en-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-sherlock"
regex = 'Sherlock'
haystack = { path = "opensubtitles/en-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-medium-needle"
regex = 'homer, marge, bart, lisa, maggie'
haystack = { path = "opensubtitles/en-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-long-needle"
regex = "I feel afraid of Mostafa\nHe is stronger and older than I am, and more experienced\nShould I turn back?\nDoc you're beginning to sound like Sherlock Holmes."
haystack = { path = "opensubtitles/en-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-en-huge-needle"
regex = "Since we will meet anyway, then the sooner, the better\nTomorrow at 4:30 in front of the Horse-Riding Club\nNo, 4:30\nI am confused, almost lost\nAs if an invisible hand pushed me towards an unknown fate\nI needed someone by my side\nI needed someone to guide me to the path of security\nBut I had no one\nI couldn't ask my father's opinion, nor his wife's\nI felt just as lonely as I had before\nI feel afraid of Mostafa\nHe is stronger and older than I am, and more experienced\nShould I turn back?\nDoc you're beginning to sound like Sherlock Holmes."
haystack = { path = "opensubtitles/en-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-en-sherlock-holmes"
regex = 'Sherlock Holmes'
haystack = { path = "opensubtitles/en-teeny.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-en-sherlock"
regex = 'Sherlock'
haystack = { path = "opensubtitles/en-teeny.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-ru-sherlock-holmes"
regex = 'Шерлок Холмс'
haystack = { path = "opensubtitles/ru-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-ru-sherlock"
regex = 'Шерлок'
haystack = { path = "opensubtitles/ru-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-ru-sherlock-holmes"
regex = 'Шерлок Холмс'
haystack = { path = "opensubtitles/ru-teeny.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-ru-sherlock"
regex = 'Шерлок'
haystack = { path = "opensubtitles/ru-teeny.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-zh-sherlock-holmes"
regex = '夏洛克·福尔摩斯'
haystack = { path = "opensubtitles/zh-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "huge-zh-sherlock"
regex = '夏洛克'
haystack = { path = "opensubtitles/zh-huge.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-zh-sherlock-holmes"
regex = '夏洛克·福尔摩斯'
haystack = { path = "opensubtitles/zh-teeny.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
[[bench]]
model = "count"
name = "teeny-zh-sherlock"
regex = '夏洛克'
haystack = { path = "opensubtitles/zh-teeny.txt" }
count = 1
engines = [
"libc/memmem/oneshot",
"rust/jetscii/memmem/oneshot",
"rust/jetscii/memmem/prebuilt",
"rust/memchr/memmem/oneshot",
"rust/memchr/memmem/prebuilt",
"rust/memchr/memmem/twoway",
"rust/memchr/memmem/rabinkarp",
"rust/memchr/memmem/shiftor",
"rust/memchr/memmem/wasm32",
"rust/memchrold/memmem/oneshot",
"rust/memchrold/memmem/prebuilt",
"rust/sliceslice/memmem/oneshot",
"rust/sliceslice/memmem/prebuilt",
"rust/std/memmem/oneshot",
"rust/std/memmem/prebuilt",
"stringzilla/memmem/oneshot",
]
================================================
FILE: benchmarks/engines/.gitignore
================================================
/target
================================================
FILE: benchmarks/engines/libc/Cargo.toml
================================================
[package]
publish = false
name = "main"
version = "0.0.0" # unclear how to get libc version in portable way
edition = "2021"
[workspace]
[dependencies]
anyhow = "1.0.100"
libc = "0.2.176"
[dependencies.shared]
path = "../../shared"
[[bin]]
name = "main"
path = "main.rs"
[profile.release]
debug = true
codegen-units = 1
lto = "fat"
================================================
FILE: benchmarks/engines/libc/main.rs
================================================
use std::io::Write;
use shared::{Benchmark, Sample};
fn main() -> anyhow::Result<()> {
let Some(arg) = std::env::args_os().nth(1) else {
anyhow::bail!("Usage: runner (<engine-name> | --version)")
};
let Ok(arg) = arg.into_string() else {
anyhow::bail!("argument given is not valid UTF-8")
};
if arg == "--version" {
// FIXME: How do we get libc version?
writeln!(std::io::stdout(), "unknown")?;
return Ok(());
}
let engine = arg;
let b = Benchmark::from_stdin()?;
let samples = match (&*engine, &*b.model) {
("memmem-oneshot", "count") => memmem_oneshot_count(&b)?,
("memchr-oneshot", "count-bytes") => memchr_oneshot_count(&b)?,
(engine, model) => {
anyhow::bail!("unrecognized engine '{engine}' and model '{model}'")
}
};
let mut stdout = std::io::stdout().lock();
for s in samples.iter() {
writeln!(stdout, "{},{}", s.duration.as_nanos(), s.count)?;
}
Ok(())
}
fn memchr_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || Ok(shared::count_memchr(haystack, needle, libc_memchr)))
}
fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
shared::run(b, || Ok(shared::count_memmem(haystack, needle, libc_memmem)))
}
/// A safe wrapper around libc's `memchr` function. In particular, this
/// converts memchr's pointer return to an index offset into `haystack`.
fn libc_memchr(haystack: &[u8], needle: u8) -> Option<usize> {
// SAFETY: This is safe to call since all pointers are valid.
let p = unsafe {
libc::memchr(
haystack.as_ptr().cast(),
needle as libc::c_int,
haystack.len(),
)
};
if p.is_null() {
None
} else {
Some(p as usize - (haystack.as_ptr() as usize))
}
}
/// A safe wrapper around libc's `memmem` function. In particular, this
/// converts memmem's pointer return to an index offset into `haystack`.
fn libc_memmem(haystack: &[u8], needle: &[u8]) -> Option<usize> {
// SAFETY: We know that both our haystack and needle pointers are valid and
// non-null, and we also know that the lengths of each corresponds to the
// number of bytes at that memory region.
let p = unsafe {
libc::memmem(
haystack.as_ptr().cast(),
haystack.len(),
needle.as_ptr().cast(),
needle.len(),
)
};
if p.is_null() {
None
} else {
let start = (p as isize) - (haystack.as_ptr() as isize);
Some(start as usize)
}
}
================================================
FILE: benchmarks/engines/rust-bytecount/Cargo.toml
================================================
[package]
publish = false
name = "main"
version = "0.6.4"
edition = "2021"
[workspace]
[dependencies]
anyhow = "1.0.100"
# Note that with bytecount 0.6.7, it seems to fail on wasm32:
#
# $ rebar measure -f '^memchr/sherlock/rare/huge1$' -e '^rust/bytecount/memchr/oneshot/wasm32$' -t
# Error: failed to run main module `./target/wasm32-wasi/release/main.wasm`
#
# Caused by:
# 0: failed to invoke command default
# 1: error while executing at wasm backtrace:
# 0: 0x7683 - <unknown>!bytecount::count::he2da8fc82662651b
# 1: 0x4887 - <unknown>!main::main::he4a1bcea0da067f8
# 2: 0x4fe - <unknown>!std::sys_common::backtrace::__rust_begin_short_backtrace::h3d2add2c8c259792
# 3: 0x7f2f - <unknown>!__main_void
# 4: 0x4d9 - <unknown>!_start
# note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
# 2: memory fault at wasm address 0x3a0000 in linear memory of size 0x3a0000
# 3: wasm trap: out of bounds memory access
# memchr/sherlock/rare/huge1,count-bytes,rust/bytecount/memchr/oneshot/wasm32,0.6.7,failed to run command for 'rust/bytecount/memchr/oneshot/wasm32'
# some benchmarks failed
#
# It's not clear what's happening here, but 0.6.4 works.
bytecount = "=0.6.4"
[dependencies.shared]
path = "../../shared"
[[bin]]
name = "main"
path = "main.rs"
[profile.release]
debug = true
codegen-units = 1
lto = "fat"
================================================
FILE: benchmarks/engines/rust-bytecount/main.rs
================================================
use std::io::Write;
use shared::{Benchmark, Sample};
fn main() -> anyhow::Result<()> {
let Some(arg) = std::env::args_os().nth(1) else {
anyhow::bail!("Usage: runner (<engine-name> | --version)")
};
let Ok(arg) = arg.into_string() else {
anyhow::bail!("argument given is not valid UTF-8")
};
if arg == "--version" {
writeln!(std::io::stdout(), env!("CARGO_PKG_VERSION"))?;
return Ok(());
}
let engine = arg;
let b = Benchmark::from_stdin()?;
let samples = match (&*engine, &*b.model) {
("memchr-oneshot", "count-bytes") => memchr_oneshot_count(&b)?,
(engine, model) => {
anyhow::bail!("unrecognized engine '{engine}' and model '{model}'")
}
};
let mut stdout = std::io::stdout().lock();
for s in samples.iter() {
writeln!(stdout, "{},{}", s.duration.as_nanos(), s.count)?;
}
Ok(())
}
fn memchr_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || Ok(bytecount::count(haystack, needle)))
}
================================================
FILE: benchmarks/engines/rust-jetscii/Cargo.toml
================================================
[package]
publish = false
name = "main"
version = "0.5.3"
edition = "2021"
[workspace]
[dependencies]
anyhow = "1.0.100"
jetscii = "=0.5.3"
[dependencies.shared]
path = "../../shared"
[[bin]]
name = "main"
path = "main.rs"
[profile.release]
debug = true
codegen-units = 1
lto = "fat"
================================================
FILE: benchmarks/engines/rust-jetscii/main.rs
================================================
use std::io::Write;
use shared::{Benchmark, Sample};
fn main() -> anyhow::Result<()> {
let Some(arg) = std::env::args_os().nth(1) else {
anyhow::bail!("Usage: runner (<engine-name> | --version)")
};
let Ok(arg) = arg.into_string() else {
anyhow::bail!("argument given is not valid UTF-8")
};
if arg == "--version" {
writeln!(std::io::stdout(), env!("CARGO_PKG_VERSION"))?;
return Ok(());
}
let engine = arg;
let b = Benchmark::from_stdin()?;
let samples = match (&*engine, &*b.model) {
("memmem-prebuilt", "count") => memmem_prebuilt_count(&b)?,
("memmem-oneshot", "count") => memmem_oneshot_count(&b)?,
(engine, model) => {
anyhow::bail!("unrecognized engine '{engine}' and model '{model}'")
}
};
let mut stdout = std::io::stdout().lock();
for s in samples.iter() {
writeln!(stdout, "{},{}", s.duration.as_nanos(), s.count)?;
}
Ok(())
}
fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let finder = jetscii::ByteSubstring::new(needle);
shared::run(b, || {
Ok(shared::count_memmem(haystack, needle, |h, _| finder.find(h)))
})
}
fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
shared::run(b, || {
Ok(shared::count_memmem(haystack, needle, |h, n| {
jetscii::ByteSubstring::new(n).find(h)
}))
})
}
================================================
FILE: benchmarks/engines/rust-memchr/Cargo.toml
================================================
[package]
publish = false
name = "main"
version = "2.7.6" # should match current 'memchr' version
edition = "2021"
[workspace]
[dependencies]
anyhow = "1.0.100"
memchr = { version = "*", path = "../../../" }
[dependencies.shared]
path = "../../shared"
[[bin]]
name = "main"
path = "main.rs"
[profile.release]
debug = true
codegen-units = 1
lto = "fat"
================================================
FILE: benchmarks/engines/rust-memchr/main.rs
================================================
use std::io::Write;
use memchr::arch::all::packedpair::HeuristicFrequencyRank;
use shared::{Benchmark, Sample};
fn main() -> anyhow::Result<()> {
let mut args = vec![];
for osarg in std::env::args_os().skip(1) {
let Ok(arg) = osarg.into_string() else {
anyhow::bail!("all arguments must be valid UTF-8")
};
args.push(arg);
}
anyhow::ensure!(
!args.is_empty(),
"Usage: runner [--quiet] (<engine-name> | --version)"
);
if args.iter().any(|a| a == "--version") {
writeln!(std::io::stdout(), env!("CARGO_PKG_VERSION"))?;
return Ok(());
}
let quiet = args.iter().any(|a| a == "--quiet");
let engine = &**args.last().unwrap();
let b = Benchmark::from_stdin()?;
let samples = match (&*engine, &*b.model) {
("memchr-oneshot", "count-bytes") => memchr_oneshot_count(&b)?,
("memchr-prebuilt", "count-bytes") => memchr_prebuilt_count(&b)?,
("memchr-onlycount", "count-bytes") => memchr_only_count(&b)?,
("memchr-fallback", "count-bytes") => memchr_fallback_count(&b)?,
("memchr-naive", "count-bytes") => memchr_naive_count(&b)?,
("memchr2", "count-bytes") => memchr2_count(&b)?,
("memchr2-fallback", "count-bytes") => memchr2_fallback_count(&b)?,
("memchr2-naive", "count-bytes") => memchr2_naive_count(&b)?,
("memchr3", "count-bytes") => memchr3_count(&b)?,
("memchr3-fallback", "count-bytes") => memchr3_fallback_count(&b)?,
("memchr3-naive", "count-bytes") => memchr3_naive_count(&b)?,
("memrchr", "count-bytes") => memrchr_count(&b)?,
("memrchr2", "count-bytes") => memrchr2_count(&b)?,
("memrchr3", "count-bytes") => memrchr3_count(&b)?,
("memmem-prebuilt", "count") => memmem_prebuilt_count(&b)?,
("memmem-oneshot", "count") => memmem_oneshot_count(&b)?,
("memmem-binary", "count") => memmem_binary_count(&b)?,
("memmem-twoway", "count") => memmem_twoway_count(&b)?,
("memmem-rabinkarp", "count") => memmem_rabinkarp_count(&b)?,
("memmem-shiftor", "count") => memmem_shiftor_count(&b)?,
("memmem-prebuilt", "needles-in-needles") => {
memmem_prebuilt_needles(&b)?
}
("memmem-prebuilt", "needles-in-haystack") => {
memmem_prebuilt_haystack(&b)?
}
(engine, model) => {
anyhow::bail!("unrecognized engine '{engine}' and model '{model}'")
}
};
if !quiet {
let mut stdout = std::io::stdout().lock();
for s in samples.iter() {
writeln!(stdout, "{},{}", s.duration.as_nanos(), s.count)?;
}
}
Ok(())
}
fn memchr_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || {
Ok(shared::count_memchr(haystack, needle, |h, n1| {
memchr::memchr(n1, h)
}))
})
}
fn memchr_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || Ok(memchr::memchr_iter(needle, haystack).count_slow()))
}
fn memchr_only_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || Ok(memchr::memchr_iter(needle, haystack).count()))
}
fn memchr_fallback_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
let finder = memchr::arch::all::memchr::One::new(needle);
shared::run(b, || Ok(finder.iter(haystack).count_slow()))
}
fn memchr_naive_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || {
Ok(shared::count_memchr(haystack, needle, |h, n1| {
h.iter().position(|&b| b == n1)
}))
})
}
fn memchr2_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2) = b.two_needle_bytes()?;
shared::run(b, || Ok(memchr::memchr2_iter(n1, n2, haystack).count_slow()))
}
fn memchr2_fallback_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2) = b.two_needle_bytes()?;
let finder = memchr::arch::all::memchr::Two::new(n1, n2);
shared::run(b, || Ok(finder.iter(haystack).count_slow()))
}
fn memchr2_naive_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2) = b.two_needle_bytes()?;
shared::run(b, || {
Ok(shared::count_memchr2(haystack, n1, n2, |h, n1, n2| {
h.iter().position(|&b| b == n1 || b == n2)
}))
})
}
fn memchr3_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2, n3) = b.three_needle_bytes()?;
shared::run(b, || {
Ok(memchr::memchr3_iter(n1, n2, n3, haystack).count_slow())
})
}
fn memchr3_fallback_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2, n3) = b.three_needle_bytes()?;
let finder = memchr::arch::all::memchr::Three::new(n1, n2, n3);
shared::run(b, || Ok(finder.iter(haystack).count_slow()))
}
fn memchr3_naive_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2, n3) = b.three_needle_bytes()?;
shared::run(b, || {
Ok(shared::count_memchr3(haystack, n1, n2, n3, |h, n1, n2, n3| {
h.iter().position(|&b| b == n1 || b == n2 || b == n3)
}))
})
}
fn memrchr_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || {
Ok(memchr::memchr_iter(needle, haystack).rev().count_slow())
})
}
fn memrchr2_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2) = b.two_needle_bytes()?;
shared::run(b, || {
Ok(memchr::memchr2_iter(n1, n2, haystack).rev().count_slow())
})
}
fn memrchr3_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2, n3) = b.three_needle_bytes()?;
shared::run(b, || {
Ok(memchr::memchr3_iter(n1, n2, n3, haystack).rev().count_slow())
})
}
fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let finder = memchr::memmem::Finder::new(needle);
shared::run(b, || Ok(finder.find_iter(haystack).count_slow()))
}
fn memmem_prebuilt_needles(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let finders = b
.needles
.iter()
.map(|n| memchr::memmem::Finder::new(n))
.collect::<Vec<_>>();
shared::run(b, || {
let mut count = 0;
for (i, finder) in finders.iter().enumerate() {
for haystack in b.needles[i..].iter() {
if finder.find(haystack).is_some() {
count += 1;
}
}
}
Ok(count)
})
}
fn memmem_prebuilt_haystack(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let finders = b
.needles
.iter()
.map(|n| memchr::memmem::Finder::new(n))
.collect::<Vec<_>>();
shared::run(b, || {
let mut count = 0;
for finder in finders.iter() {
if finder.find(haystack).is_some() {
count += 1;
}
}
Ok(count)
})
}
fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let memmem = memchr::memmem::find;
shared::run(b, || Ok(shared::count_memmem(haystack, needle, memmem)))
}
fn memmem_binary_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let finder = memchr::memmem::FinderBuilder::new()
.build_forward_with_ranker(Binary, needle);
shared::run(b, || Ok(finder.find_iter(haystack).count_slow()))
}
fn memmem_twoway_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let finder = memchr::arch::all::twoway::Finder::new(needle);
shared::run(b, || {
Ok(shared::count_memmem(haystack, needle, |h, n| finder.find(h, n)))
})
}
fn memmem_rabinkarp_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let finder = memchr::arch::all::rabinkarp::Finder::new(needle);
shared::run(b, || {
Ok(shared::count_memmem(haystack, needle, |h, n| finder.find(h, n)))
})
}
fn memmem_shiftor_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let Some(finder) = memchr::arch::all::shiftor::Finder::new(needle) else {
anyhow::bail!("could not build Shift-Or searcher for this needle")
};
shared::run(b, || {
Ok(shared::count_memmem(haystack, needle, |h, _| finder.find(h)))
})
}
/// A byte-frequency table that is good for scanning binary executables.
struct Binary;
impl HeuristicFrequencyRank for Binary {
fn rank(&self, byte: u8) -> u8 {
const TABLE: [u8; 256] = [
255, 128, 61, 43, 50, 41, 27, 28, 57, 15, 21, 13, 24, 17, 17, 89,
58, 16, 11, 7, 14, 23, 7, 6, 24, 9, 6, 5, 9, 4, 7, 16, 68, 11, 9,
6, 88, 7, 4, 4, 23, 9, 4, 8, 8, 5, 10, 4, 30, 11, 9, 24, 11, 5, 5,
5, 19, 11, 6, 17, 9, 9, 6, 8, 48, 58, 11, 14, 53, 40, 9, 9, 254,
35, 3, 6, 52, 23, 6, 6, 27, 4, 7, 11, 14, 13, 10, 11, 11, 5, 2,
10, 16, 12, 6, 19, 19, 20, 5, 14, 16, 31, 19, 7, 14, 20, 4, 4, 19,
8, 18, 20, 24, 1, 25, 19, 58, 29, 10, 5, 15, 20, 2, 2, 9, 4, 3, 5,
51, 11, 4, 53, 23, 39, 6, 4, 13, 81, 4, 186, 5, 67, 3, 2, 15, 0,
0, 1, 3, 2, 0, 0, 5, 0, 0, 0, 2, 0, 0, 0, 12, 2, 1, 1, 3, 1, 1, 1,
6, 1, 2, 1, 3, 1, 1, 2, 9, 1, 1, 0, 2, 2, 4, 4, 11, 6, 7, 3, 6, 9,
4, 5, 46, 18, 8, 18, 17, 3, 8, 20, 16, 10, 3, 7, 175, 4, 6, 7, 13,
3, 7, 3, 3, 1, 3, 3, 10, 3, 1, 5, 2, 0, 1, 2, 16, 3, 5, 1, 6, 1,
1, 2, 58, 20, 3, 14, 12, 2, 1, 3, 16, 3, 5, 8, 3, 1, 8, 6, 17, 6,
5, 3, 8, 6, 13, 175,
];
TABLE[usize::from(byte)]
}
}
trait IteratorExt: Iterator {
/// Like `Iterator::count`, but guarantees that it gets the count by
/// iterating over each element without taking any specialized shortcuts.
///
/// We do this because the memchr crate may specialize `count` in certain
/// circumstances, and we'd generally like to measure how long it takes
/// to find all occurrences of a needle and not just the number of them.
fn count_slow(mut self) -> usize
where
Self: Sized,
{
let mut count = 0;
while let Some(_) = self.next() {
count += 1;
}
count
}
}
impl<I: Iterator> IteratorExt for I {}
================================================
FILE: benchmarks/engines/rust-memchrold/Cargo.toml
================================================
[package]
publish = false
name = "main"
version = "2.5.0" # should match 'memchr' version below
edition = "2021"
[workspace]
[dependencies]
anyhow = "1.0.100"
memchr = "=2.5.0"
[dependencies.shared]
path = "../../shared"
[[bin]]
name = "main"
path = "main.rs"
[profile.release]
debug = true
codegen-units = 1
lto = "fat"
================================================
FILE: benchmarks/engines/rust-memchrold/main.rs
================================================
use std::io::Write;
use shared::{Benchmark, Sample};
fn main() -> anyhow::Result<()> {
let mut args = vec![];
for osarg in std::env::args_os().skip(1) {
let Ok(arg) = osarg.into_string() else {
anyhow::bail!("all arguments must be valid UTF-8")
};
args.push(arg);
}
anyhow::ensure!(
!args.is_empty(),
"Usage: runner [--quiet] (<engine-name> | --version)"
);
if args.iter().any(|a| a == "--version") {
writeln!(std::io::stdout(), env!("CARGO_PKG_VERSION"))?;
return Ok(());
}
let quiet = args.iter().any(|a| a == "--quiet");
let engine = &**args.last().unwrap();
let b = Benchmark::from_stdin()?;
let samples = match (&*engine, &*b.model) {
("memchr-oneshot", "count-bytes") => memchr_oneshot_count(&b)?,
("memchr-prebuilt", "count-bytes") => memchr_prebuilt_count(&b)?,
("memchr-naive", "count-bytes") => memchr_naive_count(&b)?,
("memchr2", "count-bytes") => memchr2_count(&b)?,
("memchr3", "count-bytes") => memchr3_count(&b)?,
("memrchr", "count-bytes") => memrchr_count(&b)?,
("memrchr2", "count-bytes") => memrchr2_count(&b)?,
("memrchr3", "count-bytes") => memrchr3_count(&b)?,
("memmem-prebuilt", "count") => memmem_prebuilt_count(&b)?,
("memmem-oneshot", "count") => memmem_oneshot_count(&b)?,
("memmem-prebuilt", "needles-in-needles") => {
memmem_prebuilt_needles(&b)?
}
("memmem-prebuilt", "needles-in-haystack") => {
memmem_prebuilt_haystack(&b)?
}
(engine, model) => {
anyhow::bail!("unrecognized engine '{engine}' and model '{model}'")
}
};
if !quiet {
let mut stdout = std::io::stdout().lock();
for s in samples.iter() {
writeln!(stdout, "{},{}", s.duration.as_nanos(), s.count)?;
}
}
Ok(())
}
fn memchr_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || {
Ok(shared::count_memchr(haystack, needle, |h, n1| {
memchr::memchr(n1, h)
}))
})
}
fn memchr_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || Ok(memchr::memchr_iter(needle, haystack).count()))
}
fn memchr_naive_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || {
Ok(shared::count_memchr(haystack, needle, |h, n1| {
h.iter().position(|&b| b == n1)
}))
})
}
fn memchr2_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2) = b.two_needle_bytes()?;
shared::run(b, || Ok(memchr::memchr2_iter(n1, n2, haystack).count()))
}
fn memchr3_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2, n3) = b.three_needle_bytes()?;
shared::run(b, || Ok(memchr::memchr3_iter(n1, n2, n3, haystack).count()))
}
fn memrchr_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle_byte()?;
shared::run(b, || Ok(memchr::memchr_iter(needle, haystack).rev().count()))
}
fn memrchr2_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2) = b.two_needle_bytes()?;
shared::run(b, || Ok(memchr::memchr2_iter(n1, n2, haystack).rev().count()))
}
fn memrchr3_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let (n1, n2, n3) = b.three_needle_bytes()?;
shared::run(b, || {
Ok(memchr::memchr3_iter(n1, n2, n3, haystack).rev().count())
})
}
fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let finder = memchr::memmem::Finder::new(needle);
shared::run(b, || Ok(finder.find_iter(haystack).count()))
}
fn memmem_prebuilt_needles(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let finders = b
.needles
.iter()
.map(|n| memchr::memmem::Finder::new(n))
.collect::<Vec<_>>();
shared::run(b, || {
let mut count = 0;
for (i, finder) in finders.iter().enumerate() {
for haystack in b.needles[i..].iter() {
if finder.find(haystack).is_some() {
count += 1;
}
}
}
Ok(count)
})
}
fn memmem_prebuilt_haystack(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let finders = b
.needles
.iter()
.map(|n| memchr::memmem::Finder::new(n))
.collect::<Vec<_>>();
shared::run(b, || {
let mut count = 0;
for finder in finders.iter() {
if finder.find(haystack).is_some() {
count += 1;
}
}
Ok(count)
})
}
fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
let memmem = memchr::memmem::find;
shared::run(b, || Ok(shared::count_memmem(haystack, needle, memmem)))
}
================================================
FILE: benchmarks/engines/rust-sliceslice/Cargo.toml
================================================
[package]
publish = false
name = "main"
version = "0.4.3" # should match 'sliceslice' version below
edition = "2021"
[workspace]
[dependencies]
anyhow = "1.0.100"
sliceslice = "0.4.3"
[dependencies.shared]
path = "../../shared"
[[bin]]
name = "main"
path = "main.rs"
[profile.release]
debug = true
codegen-units = 1
lto = "fat"
================================================
FILE: benchmarks/engines/rust-sliceslice/main.rs
================================================
use std::io::Write;
use shared::{Benchmark, Sample};
fn main() -> anyhow::Result<()> {
let Some(arg) = std::env::args_os().nth(1) else {
anyhow::bail!("Usage: runner (<engine-name> | --version)")
};
let Ok(arg) = arg.into_string() else {
anyhow::bail!("argument given is not valid UTF-8")
};
if arg == "--version" {
writeln!(std::io::stdout(), env!("CARGO_PKG_VERSION"))?;
return Ok(());
}
let engine = arg;
let b = Benchmark::from_stdin()?;
let samples = match (&*engine, &*b.model) {
("memmem-prebuilt", "count") => memmem_prebuilt_count(&b)?,
("memmem-oneshot", "count") => memmem_oneshot_count(&b)?,
("memmem-prebuilt", "needles-in-needles") => {
memmem_prebuilt_needles(&b)?
}
("memmem-prebuilt", "needles-in-haystack") => {
memmem_prebuilt_haystack(&b)?
}
(engine, model) => {
anyhow::bail!("unrecognized engine '{engine}' and model '{model}'")
}
};
let mut stdout = std::io::stdout().lock();
for s in samples.iter() {
writeln!(stdout, "{},{}", s.duration.as_nanos(), s.count)?;
}
Ok(())
}
// The sliceslice crate perplexingly only offers "does the needle occur at
// least once in the haystack" APIs, and does not actually report the offset
// at which the needle matches. It's therefore questionable to even bother
// benchmarking it, but alas, it is quite fast and has been heavily optimized.
// But this does mean we can only use sliceslice in benchmarks with a count
// equal to 0 or 1. (We could define a distinct "does any match occur" model,
// but it does not seem worth it.)
fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
#[cfg(target_arch = "x86_64")]
{
use sliceslice::x86::DynamicAvx2Searcher;
anyhow::ensure!(
is_x86_feature_detected!("avx2"),
"AVX2 not available"
);
let haystack = &b.haystack;
let needle = b.one_needle()?;
// SAFETY: We just checked that avx2 is available.
unsafe {
let finder = DynamicAvx2Searcher::new(needle);
shared::run(b, || {
Ok(if finder.search_in(haystack) { 1 } else { 0 })
})
}
}
#[cfg(target_arch = "aarch64")]
{
use sliceslice::aarch64::NeonSearcher;
anyhow::ensure!(
std::arch::is_aarch64_feature_detected!("neon"),
"NEON not available"
);
let haystack = &b.haystack;
let needle = b.one_needle()?;
// SAFETY: We just checked that avx2 is available.
unsafe {
let finder = NeonSearcher::new(needle);
shared::run(b, || {
Ok(if finder.search_in(haystack) { 1 } else { 0 })
})
}
}
}
fn memmem_prebuilt_needles(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
#[cfg(target_arch = "x86_64")]
{
use sliceslice::x86::DynamicAvx2Searcher;
anyhow::ensure!(
is_x86_feature_detected!("avx2"),
"AVX2 not available"
);
let finders = b
.needles
.iter()
// SAFETY: We just checked that avx2 is available.
.map(|n| unsafe { DynamicAvx2Searcher::new(n) })
.collect::<Vec<_>>();
shared::run(b, || {
let mut count = 0;
for (i, finder) in finders.iter().enumerate() {
for haystack in b.needles[i..].iter() {
// SAFETY: We just checked that avx2 is available.
unsafe {
if finder.search_in(haystack) {
count += 1;
}
}
}
}
Ok(count)
})
}
#[cfg(target_arch = "aarch64")]
{
use sliceslice::aarch64::NeonSearcher;
anyhow::ensure!(
std::arch::is_aarch64_feature_detected!("neon"),
"NEON not available"
);
let finders = b
.needles
.iter()
// SAFETY: We just checked that avx2 is available.
.map(|n| unsafe { NeonSearcher::new(n) })
.collect::<Vec<_>>();
shared::run(b, || {
let mut count = 0;
for (i, finder) in finders.iter().enumerate() {
for haystack in b.needles[i..].iter() {
// SAFETY: We just checked that avx2 is available.
unsafe {
if finder.search_in(haystack) {
count += 1;
}
}
}
}
Ok(count)
})
}
}
fn memmem_prebuilt_haystack(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
#[cfg(target_arch = "x86_64")]
{
use sliceslice::x86::DynamicAvx2Searcher;
anyhow::ensure!(
is_x86_feature_detected!("avx2"),
"AVX2 not available"
);
let haystack = &b.haystack;
let finders = b
.needles
.iter()
// SAFETY: We just checked that avx2 is available.
.map(|n| unsafe { DynamicAvx2Searcher::new(n) })
.collect::<Vec<_>>();
shared::run(b, || {
let mut count = 0;
for finder in finders.iter() {
// SAFETY: We just checked that avx2 is available.
unsafe {
if finder.search_in(haystack) {
count += 1;
}
}
}
Ok(count)
})
}
#[cfg(target_arch = "aarch64")]
{
use sliceslice::aarch64::NeonSearcher;
anyhow::ensure!(
std::arch::is_aarch64_feature_detected!("neon"),
"NEON not available"
);
let haystack = &b.haystack;
let finders = b
.needles
.iter()
// SAFETY: We just checked that avx2 is available.
.map(|n| unsafe { NeonSearcher::new(n) })
.collect::<Vec<_>>();
shared::run(b, || {
let mut count = 0;
for finder in finders.iter() {
// SAFETY: We just checked that avx2 is available.
unsafe {
if finder.search_in(haystack) {
count += 1;
}
}
}
Ok(count)
})
}
}
fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
#[cfg(target_arch = "x86_64")]
{
use sliceslice::x86::DynamicAvx2Searcher;
anyhow::ensure!(
is_x86_feature_detected!("avx2"),
"AVX2 not available"
);
let haystack = &b.haystack;
let needle = b.one_needle()?;
shared::run(b, || {
// SAFETY: We just checked that avx2 is available.
Ok(unsafe {
if DynamicAvx2Searcher::new(needle).search_in(haystack) {
1
} else {
0
}
})
})
}
#[cfg(target_arch = "aarch64")]
{
use sliceslice::aarch64::NeonSearcher;
anyhow::ensure!(
std::arch::is_aarch64_feature_detected!("neon"),
"NEON not available"
);
let haystack = &b.haystack;
let needle = b.one_needle()?;
shared::run(b, || {
// SAFETY: We just checked that avx2 is available.
Ok(unsafe {
if NeonSearcher::new(needle).search_in(haystack) {
1
} else {
0
}
})
})
}
}
================================================
FILE: benchmarks/engines/rust-std/Cargo.toml
================================================
[package]
publish = false
name = "main"
version = "0.0.0" # we get version from build script
edition = "2021"
[workspace]
[dependencies]
anyhow = "1.0.100"
[build-dependencies]
regex-lite = "0.1"
[dependencies.shared]
path = "../../shared"
[[bin]]
name = "main"
path = "main.rs"
[profile.release]
debug = true
codegen-units = 1
lto = "fat"
================================================
FILE: benchmarks/engines/rust-std/build.rs
================================================
use std::process::Command;
use regex_lite::Regex;
fn main() {
let version = rustc_version().unwrap_or("unknown".to_string());
println!("cargo:rustc-env=RUSTC_VERSION={}", version);
}
fn rustc_version() -> Option<String> {
let re = Regex::new(
r"^rustc (?<version>\d+\.\d+\.\d+(?:-\S+)) \((?<rev>[0-9a-f]+)",
)
.unwrap();
let output = Command::new("rustc").arg("--version").output().ok()?;
let stdout = String::from_utf8_lossy(&output.stdout).trim().to_string();
let first_line = stdout.lines().next()?;
let caps = re.captures(first_line)?;
Some(format!("{} {}", &caps["version"], &caps["rev"]))
}
================================================
FILE: benchmarks/engines/rust-std/main.rs
================================================
use std::io::Write;
use shared::{Benchmark, Sample};
fn main() -> anyhow::Result<()> {
let Some(arg) = std::env::args_os().nth(1) else {
anyhow::bail!("Usage: runner (<engine-name> | --version)")
};
let Ok(arg) = arg.into_string() else {
anyhow::bail!("argument given is not valid UTF-8")
};
if arg == "--version" {
writeln!(std::io::stdout(), env!("RUSTC_VERSION"))?;
return Ok(());
}
let engine = arg;
let b = Benchmark::from_stdin()?;
let samples = match (&*engine, &*b.model) {
("memmem-oneshot", "count") => memmem_oneshot_count(&b)?,
("memmem-prebuilt", "count") => memmem_prebuilt_count(&b)?,
(engine, model) => {
anyhow::bail!("unrecognized engine '{engine}' and model '{model}'")
}
};
let mut stdout = std::io::stdout().lock();
for s in samples.iter() {
writeln!(stdout, "{},{}", s.duration.as_nanos(), s.count)?;
}
Ok(())
}
fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = std::str::from_utf8(&b.haystack)?;
let needle = std::str::from_utf8(b.one_needle()?)?;
shared::run(b, || {
Ok(shared::count_memmem_str(haystack, needle, |h, n| {
h.match_indices(n).map(|(i, _)| i).next()
}))
})
}
/// A prebuilt version of the std searcher. This isn't quite as "prebuilt" as
/// is possible, since each measurement doesn't just include the creation of
/// the iterator but also the searcher. Where as the memchr crate can do this
/// where the searcher is created once and the measurement only includes the
/// creation of the iterator.
///
/// So probably we "should" have created some other kind of engine called
/// "partial prebuilt" but it makes things even more confusing. At some point,
/// this is just the way the cookie crumbles.
///
/// Remember, it's not that oneshot and prebuilt aren't comparable.
/// It's absolutely fair to say, for example, "Rust's standard library
/// substring search is slow because it doesn't let one amortize the cost of
/// construction." But it's *also* interesting to make these assumptions a
/// little more explicit in our measurement model. But we do this within
/// reason.
fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = std::str::from_utf8(&b.haystack)?;
let needle = std::str::from_utf8(b.one_needle()?)?;
shared::run(b, || Ok(haystack.matches(needle).count()))
}
================================================
FILE: benchmarks/engines/stringzilla/Cargo.toml
================================================
[package]
publish = false
name = "main"
version = "4.0.14" # should match 'stringzilla' version below
edition = "2021"
[workspace]
[dependencies]
anyhow = "1.0.100"
stringzilla = "=4.0.14"
[dependencies.shared]
path = "../../shared"
[[bin]]
name = "main"
path = "main.rs"
[profile.release]
debug = true
codegen-units = 1
lto = "fat"
================================================
FILE: benchmarks/engines/stringzilla/main.rs
================================================
use std::io::Write;
use shared::{Benchmark, Sample};
use stringzilla::stringzilla::StringZillableBinary;
fn main() -> anyhow::Result<()> {
let Some(arg) = std::env::args_os().nth(1) else {
anyhow::bail!("Usage: runner (<engine-name> | --version)")
};
let Ok(arg) = arg.into_string() else {
anyhow::bail!("argument given is not valid UTF-8")
};
if arg == "--version" {
writeln!(std::io::stdout(), env!("CARGO_PKG_VERSION"))?;
return Ok(());
}
let engine = arg;
let b = Benchmark::from_stdin()?;
let samples = match (&*engine, &*b.model) {
("memmem-oneshot", "count") => memmem_oneshot_count(&b)?,
(engine, model) => {
anyhow::bail!("unrecognized engine '{engine}' and model '{model}'")
}
};
let mut stdout = std::io::stdout().lock();
for s in samples.iter() {
writeln!(stdout, "{},{}", s.duration.as_nanos(), s.count)?;
}
Ok(())
}
fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
let haystack = &b.haystack;
let needle = b.one_needle()?;
shared::run(b, || {
Ok(shared::count_memmem(haystack, needle, |h, n| h.sz_find(n)))
})
}
================================================
FILE: benchmarks/engines.toml
================================================
# Engines from C's standard library, i.e., `memchr` and `memmem`.
[[engine]]
name = "libc/memchr/oneshot"
cwd = "./engines/libc"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "libc/memmem/oneshot"
cwd = "./engines/libc"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
# Engines based on the `bytecount` Rust crate.
#
# Note that we call it a "memchr" engine, but all it can do is report the count
# of matches and not individual offsets. So one needs to be careful when doing
# comparisons. We include it here because the `memchr` crate has a similar
# optimization when you call `Iterator::count`.
[[engine]]
name = "rust/bytecount/memchr/oneshot"
cwd = "./engines/rust-bytecount"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/bytecount/memchr/oneshot/wasm32"
cwd = "./engines/rust-bytecount"
[engine.version]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"--version",
]
[engine.run]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"memchr-oneshot",
]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
# Engines based on the `jetscii` Rust crate.
[[engine]]
name = "rust/jetscii/memmem/prebuilt"
cwd = "./engines/rust-jetscii"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-prebuilt"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/jetscii/memmem/oneshot"
cwd = "./engines/rust-jetscii"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
# Engines based on the `sliceslice` Rust crate.
#
# Note that this crate only supports "does the haystack match or not." It does
# not report offsets at which a match occurs.
[[engine]]
name = "rust/sliceslice/memmem/prebuilt"
cwd = "./engines/rust-sliceslice"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-prebuilt"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/sliceslice/memmem/oneshot"
cwd = "./engines/rust-sliceslice"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
# Engines based on the `stringzilla` library.
#
# See: https://github.com/ashvardanian/StringZilla
[[engine]]
name = "stringzilla/memmem/oneshot"
cwd = "./engines/stringzilla"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
# Engines based on the Rust standard library.
[[engine]]
name = "rust/std/memmem/prebuilt"
cwd = "./engines/rust-std"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-prebuilt"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/std/memmem/oneshot"
cwd = "./engines/rust-std"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
# All of the engines from the `memchr` crate are below. There are a lot of them
# because the `memchr` crate exposes a lot of different APIs.
#
# A lot of the engine names include qualifiers like 'oneshot' and 'prebuilt'.
# The former means that the measurement includes both the construction of the
# searcher and the search itself. The latter means that only the search itself
# (to the extent possible) is measured. If an engine name doesn't have
# 'oneshot' or 'prebuilt' in it, then that generally means it is 'prebuilt'.
# The main utility of 'oneshot' engines is to make them comparable to other
# implementations that only expose oneshot APIs. For example, libc's memchr and
# memmem.
[[engine]]
name = "rust/memchr/memchr/oneshot"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr/prebuilt"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-prebuilt"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr/onlycount"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-onlycount"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr/fallback"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-fallback"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr/naive"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-naive"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr2"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr2"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr2/fallback"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr2-fallback"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr2/naive"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr2-naive"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr3"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr3"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr3/fallback"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr3-fallback"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memchr3/naive"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr3-naive"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memrchr"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memrchr"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memrchr2"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memrchr2"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memrchr3"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memrchr3"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memmem/prebuilt"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-prebuilt"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memmem/oneshot"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memmem/binary"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-binary"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memmem/twoway"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-twoway"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memmem/rabinkarp"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-rabinkarp"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchr/memmem/shiftor"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-shiftor"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
# Engines that specifically target wasm32. These reuse the actual code from
# existing engines in `rust/memchr`, but change the build configuration to
# build for `wasm32-wasip1` and use the `wasmtime` JIT to actually run it. We
# don't define every possible engine for wasm32, but just a subset for basic
# sanity checks. If it would be beneficial to be more exhaustive, please file
# an issue.
[[engine]]
name = "rust/memchr/memchr/wasm32"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"--version",
]
[engine.run]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"memchr-prebuilt",
]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine]]
name = "rust/memchr/memchr/onlycount/wasm32"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"--version",
]
[engine.run]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"memchr-onlycount",
]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine]]
name = "rust/memchr/memchr2/wasm32"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"--version",
]
[engine.run]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"memchr2",
]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine]]
name = "rust/memchr/memchr3/wasm32"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"--version",
]
[engine.run]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"memchr3",
]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine]]
name = "rust/memchr/memmem/wasm32"
cwd = "./engines/rust-memchr"
[engine.version]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"--version",
]
[engine.run]
bin = "wasmtime"
args = [
"run", "--wasm", "simd", "--",
"./target/wasm32-wasip1/release/main.wasm",
"memmem-prebuilt",
]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
envs = [
{ name = "CARGO_BUILD_TARGET", value = "wasm32-wasip1" },
{ name = "RUSTFLAGS", value = "-Ctarget-feature=+simd128" },
]
# Engines that specifically target memchr 2.5.0.
[[engine]]
name = "rust/memchrold/memchr/oneshot"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memchr/prebuilt"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-prebuilt"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memchr/naive"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr-naive"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memchr2"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr2"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memchr3"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memchr3"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memrchr"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memrchr"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memrchr2"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memrchr2"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memrchr3"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memrchr3"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memmem/prebuilt"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-prebuilt"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
[[engine]]
name = "rust/memchrold/memmem/oneshot"
cwd = "./engines/rust-memchrold"
[engine.version]
bin = "./target/release/main"
args = ["--version"]
[engine.run]
bin = "./target/release/main"
args = ["memmem-oneshot"]
[[engine.build]]
bin = "cargo"
args = ["build", "--release"]
[[engine.clean]]
bin = "cargo"
args = ["clean"]
================================================
FILE: benchmarks/haystacks/README.md
================================================
This directory contains benchmark corpora. Each sub-directory contains a README
documenting the corpus a bit more.
================================================
FILE: benchmarks/haystacks/code/README.md
================================================
This data contains corpora generated from source code. These sorts of corpora
are important because code is something that is frequently searched.
This corpus was generated by running
```
$ find ./library/alloc -name '*.rs' -print0 \
| xargs -0 cat > .../memchr/bench/data/code/rust-library.rs
```
in a checkout of the https://github.com/rust-lang/rust repository at commit
78c963945aa35a76703bf62e024af2d85b2796e2.
================================================
FILE: benchmarks/haystacks/code/rust-library.rs
================================================
use std::collections::LinkedList;
use test::Bencher;
#[bench]
fn bench_collect_into(b: &mut Bencher) {
let v = &[0; 64];
b.iter(|| {
let _: LinkedList<_> = v.iter().cloned().collect();
})
}
#[bench]
fn bench_push_front(b: &mut Bencher) {
let mut m: LinkedList<_> = LinkedList::new();
b.iter(|| {
m.push_front(0);
})
}
#[bench]
fn bench_push_back(b: &mut Bencher) {
let mut m: LinkedList<_> = LinkedList::new();
b.iter(|| {
m.push_back(0);
})
}
#[bench]
fn bench_push_back_pop_back(b: &mut Bencher) {
let mut m: LinkedList<_> = LinkedList::new();
b.iter(|| {
m.push_back(0);
m.pop_back();
})
}
#[bench]
fn bench_push_front_pop_front(b: &mut Bencher) {
let mut m: LinkedList<_> = LinkedList::new();
b.iter(|| {
m.push_front(0);
m.pop_front();
})
}
#[bench]
fn bench_iter(b: &mut Bencher) {
let v = &[0; 128];
let m: LinkedList<_> = v.iter().cloned().collect();
b.iter(|| {
assert!(m.iter().count() == 128);
})
}
#[bench]
fn bench_iter_mut(b: &mut Bencher) {
let v = &[0; 128];
let mut m: LinkedList<_> = v.iter().cloned().collect();
b.iter(|| {
assert!(m.iter_mut().count() == 128);
})
}
#[bench]
fn bench_iter_rev(b: &mut Bencher) {
let v = &[0; 128];
let m: LinkedList<_> = v.iter().cloned().collect();
b.iter(|| {
assert!(m.iter().rev().count() == 128);
})
}
#[bench]
fn bench_iter_mut_rev(b: &mut Bencher) {
let v = &[0; 128];
let mut m: LinkedList<_> = v.iter().cloned().collect();
b.iter(|| {
assert!(m.iter_mut().rev().count() == 128);
})
}
use test::{black_box, Bencher};
#[bench]
fn char_iterator(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
b.iter(|| s.chars().count());
}
#[bench]
fn char_iterator_for(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
b.iter(|| {
for ch in s.chars() {
black_box(ch);
}
});
}
#[bench]
fn char_iterator_ascii(b: &mut Bencher) {
let s = "Mary had a little lamb, Little lamb
Mary had a little lamb, Little lamb
Mary had a little lamb, Little lamb
Mary had a little lamb, Little lamb
Mary had a little lamb, Little lamb
Mary had a little lamb, Little lamb";
b.iter(|| s.chars().count());
}
#[bench]
fn char_iterator_rev(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
b.iter(|| s.chars().rev().count());
}
#[bench]
fn char_iterator_rev_for(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
b.iter(|| {
for ch in s.chars().rev() {
black_box(ch);
}
});
}
#[bench]
fn char_indicesator(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
let len = s.chars().count();
b.iter(|| assert_eq!(s.char_indices().count(), len));
}
#[bench]
fn char_indicesator_rev(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
let len = s.chars().count();
b.iter(|| assert_eq!(s.char_indices().rev().count(), len));
}
#[bench]
fn split_unicode_ascii(b: &mut Bencher) {
let s = "ประเทศไทย中华Việt Namประเทศไทย中华Việt Nam";
b.iter(|| assert_eq!(s.split('V').count(), 3));
}
#[bench]
fn split_ascii(b: &mut Bencher) {
let s = "Mary had a little lamb, Little lamb, little-lamb.";
let len = s.split(' ').count();
b.iter(|| assert_eq!(s.split(' ').count(), len));
}
#[bench]
fn split_extern_fn(b: &mut Bencher) {
let s = "Mary had a little lamb, Little lamb, little-lamb.";
let len = s.split(' ').count();
fn pred(c: char) -> bool {
c == ' '
}
b.iter(|| assert_eq!(s.split(pred).count(), len));
}
#[bench]
fn split_closure(b: &mut Bencher) {
let s = "Mary had a little lamb, Little lamb, little-lamb.";
let len = s.split(' ').count();
b.iter(|| assert_eq!(s.split(|c: char| c == ' ').count(), len));
}
#[bench]
fn split_slice(b: &mut Bencher) {
let s = "Mary had a little lamb, Little lamb, little-lamb.";
let len = s.split(' ').count();
let c: &[char] = &[' '];
b.iter(|| assert_eq!(s.split(c).count(), len));
}
#[bench]
fn bench_join(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
let sep = "→";
let v = vec![s, s, s, s, s, s, s, s, s, s];
b.iter(|| {
assert_eq!(v.join(sep).len(), s.len() * 10 + sep.len() * 9);
})
}
#[bench]
fn bench_contains_short_short(b: &mut Bencher) {
let haystack = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
let needle = "sit";
b.iter(|| {
assert!(haystack.contains(needle));
})
}
#[bench]
fn bench_contains_short_long(b: &mut Bencher) {
let haystack = "\
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem sit amet dolor \
ultricies condimentum. Praesent iaculis purus elit, ac malesuada quam malesuada in. Duis sed orci \
eros. Suspendisse sit amet magna mollis, mollis nunc luctus, imperdiet mi. Integer fringilla non \
sem ut lacinia. Fusce varius tortor a risus porttitor hendrerit. Morbi mauris dui, ultricies nec \
tempus vel, gravida nec quam.
In est dui, tincidunt sed tempus interdum, adipiscing laoreet ante. Etiam tempor, tellus quis \
sagittis interdum, nulla purus mattis sem, quis auctor erat odio ac tellus. In nec nunc sit amet \
diam volutpat molestie at sed ipsum. Vestibulum laoreet consequat vulputate. Integer accumsan \
lorem ac dignissim placerat. Suspendisse convallis faucibus lorem. Aliquam erat volutpat. In vel \
eleifend felis. Sed suscipit nulla lorem, sed mollis est sollicitudin et. Nam fermentum egestas \
interdum. Curabitur ut nisi justo.
Sed sollicitudin ipsum tellus, ut condimentum leo eleifend nec. Cras ut velit ante. Phasellus nec \
mollis odio. Mauris molestie erat in arcu mattis, at aliquet dolor vehicula. Quisque malesuada \
lectus sit amet nisi pretium, a condimentum ipsum porta. Morbi at dapibus diam. Praesent egestas \
est sed risus elementum, eu rutrum metus ultrices. Etiam fermentum consectetur magna, id rutrum \
felis accumsan a. Aliquam ut pellentesque libero. Sed mi nulla, lobortis eu tortor id, suscipit \
ultricies neque. Morbi iaculis sit amet risus at iaculis. Praesent eget ligula quis turpis \
feugiat suscipit vel non arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. \
Aliquam sit amet placerat lorem.
Cras a lacus vel ante posuere elementum. Nunc est leo, bibendum ut facilisis vel, bibendum at \
mauris. Nullam adipiscing diam vel odio ornare, luctus adipiscing mi luctus. Nulla facilisi. \
Mauris adipiscing bibendum neque, quis adipiscing lectus tempus et. Sed feugiat erat et nisl \
lobortis pharetra. Donec vitae erat enim. Nullam sit amet felis et quam lacinia tincidunt. Aliquam \
suscipit dapibus urna. Sed volutpat urna in magna pulvinar volutpat. Phasellus nec tellus ac diam \
cursus accumsan.
Nam lectus enim, dapibus non nisi tempor, consectetur convallis massa. Maecenas eleifend dictum \
feugiat. Etiam quis mauris vel risus luctus mattis a a nunc. Nullam orci quam, imperdiet id \
vehicula in, porttitor ut nibh. Duis sagittis adipiscing nisl vitae congue. Donec mollis risus eu \
leo suscipit, varius porttitor nulla porta. Pellentesque ut sem nec nisi euismod vehicula. Nulla \
malesuada sollicitudin quam eu fermentum.";
let needle = "english";
b.iter(|| {
assert!(!haystack.contains(needle));
})
}
#[bench]
fn bench_contains_bad_naive(b: &mut Bencher) {
let haystack = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
let needle = "aaaaaaaab";
b.iter(|| {
assert!(!haystack.contains(needle));
})
}
#[bench]
fn bench_contains_equal(b: &mut Bencher) {
let haystack = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
let needle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
b.iter(|| {
assert!(haystack.contains(needle));
})
}
macro_rules! make_test_inner {
($s:ident, $code:expr, $name:ident, $str:expr, $iters:expr) => {
#[bench]
fn $name(bencher: &mut Bencher) {
let mut $s = $str;
black_box(&mut $s);
bencher.iter(|| {
for _ in 0..$iters {
black_box($code);
}
});
}
};
}
macro_rules! make_test {
($name:ident, $s:ident, $code:expr) => {
make_test!($name, $s, $code, 1);
};
($name:ident, $s:ident, $code:expr, $iters:expr) => {
mod $name {
use test::Bencher;
use test::black_box;
// Short strings: 65 bytes each
make_test_inner!($s, $code, short_ascii,
"Mary had a little lamb, Little lamb Mary had a littl lamb, lamb!", $iters);
make_test_inner!($s, $code, short_mixed,
"ศไทย中华Việt Nam; Mary had a little lamb, Little lam!", $iters);
make_test_inner!($s, $code, short_pile_of_poo,
"💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩!", $iters);
make_test_inner!($s, $code, long_lorem_ipsum,"\
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem sit amet dolor \
ultricies condimentum. Praesent iaculis purus elit, ac malesuada quam malesuada in. Duis sed orci \
eros. Suspendisse sit amet magna mollis, mollis nunc luctus, imperdiet mi. Integer fringilla non \
sem ut lacinia. Fusce varius tortor a risus porttitor hendrerit. Morbi mauris dui, ultricies nec \
tempus vel, gravida nec quam.
In est dui, tincidunt sed tempus interdum, adipiscing laoreet ante. Etiam tempor, tellus quis \
sagittis interdum, nulla purus mattis sem, quis auctor erat odio ac tellus. In nec nunc sit amet \
diam volutpat molestie at sed ipsum. Vestibulum laoreet consequat vulputate. Integer accumsan \
lorem ac dignissim placerat. Suspendisse convallis faucibus lorem. Aliquam erat volutpat. In vel \
eleifend felis. Sed suscipit nulla lorem, sed mollis est sollicitudin et. Nam fermentum egestas \
interdum. Curabitur ut nisi justo.
Sed sollicitudin ipsum tellus, ut condimentum leo eleifend nec. Cras ut velit ante. Phasellus nec \
mollis odio. Mauris molestie erat in arcu mattis, at aliquet dolor vehicula. Quisque malesuada \
lectus sit amet nisi pretium, a condimentum ipsum porta. Morbi at dapibus diam. Praesent egestas \
est sed risus elementum, eu rutrum metus ultrices. Etiam fermentum consectetur magna, id rutrum \
felis accumsan a. Aliquam ut pellentesque libero. Sed mi nulla, lobortis eu tortor id, suscipit \
ultricies neque. Morbi iaculis sit amet risus at iaculis. Praesent eget ligula quis turpis \
feugiat suscipit vel non arcu. Interdum et malesuada fames ac ante ipsum primis in faucibus. \
Aliquam sit amet placerat lorem.
Cras a lacus vel ante posuere elementum. Nunc est leo, bibendum ut facilisis vel, bibendum at \
mauris. Nullam adipiscing diam vel odio ornare, luctus adipiscing mi luctus. Nulla facilisi. \
Mauris adipiscing bibendum neque, quis adipiscing lectus tempus et. Sed feugiat erat et nisl \
lobortis pharetra. Donec vitae erat enim. Nullam sit amet felis et quam lacinia tincidunt. Aliquam \
suscipit dapibus urna. Sed volutpat urna in magna pulvinar volutpat. Phasellus nec tellus ac diam \
cursus accumsan.
Nam lectus enim, dapibus non nisi tempor, consectetur convallis massa. Maecenas eleifend dictum \
feugiat. Etiam quis mauris vel risus luctus mattis a a nunc. Nullam orci quam, imperdiet id \
vehicula in, porttitor ut nibh. Duis sagittis adipiscing nisl vitae congue. Donec mollis risus eu \
leo suscipit, varius porttitor nulla porta. Pellentesque ut sem nec nisi euismod vehicula. Nulla \
malesuada sollicitudin quam eu fermentum!", $iters);
}
}
}
make_test!(chars_count, s, s.chars().count());
make_test!(contains_bang_str, s, s.contains("!"));
make_test!(contains_bang_char, s, s.contains('!'));
make_test!(match_indices_a_str, s, s.match_indices("a").count());
make_test!(split_a_str, s, s.split("a").count());
make_test!(trim_ascii_char, s, { s.trim_matches(|c: char| c.is_ascii()) });
make_test!(trim_start_ascii_char, s, { s.trim_start_matches(|c: char| c.is_ascii()) });
make_test!(trim_end_ascii_char, s, { s.trim_end_matches(|c: char| c.is_ascii()) });
make_test!(find_underscore_char, s, s.find('_'));
make_test!(rfind_underscore_char, s, s.rfind('_'));
make_test!(find_underscore_str, s, s.find("_"));
make_test!(find_zzz_char, s, s.find('\u{1F4A4}'));
make_test!(rfind_zzz_char, s, s.rfind('\u{1F4A4}'));
make_test!(find_zzz_str, s, s.find("\u{1F4A4}"));
make_test!(starts_with_ascii_char, s, s.starts_with('/'), 1024);
make_test!(ends_with_ascii_char, s, s.ends_with('/'), 1024);
make_test!(starts_with_unichar, s, s.starts_with('\u{1F4A4}'), 1024);
make_test!(ends_with_unichar, s, s.ends_with('\u{1F4A4}'), 1024);
make_test!(starts_with_str, s, s.starts_with("💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩"), 1024);
make_test!(ends_with_str, s, s.ends_with("💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩💩"), 1024);
make_test!(split_space_char, s, s.split(' ').count());
make_test!(split_terminator_space_char, s, s.split_terminator(' ').count());
make_test!(splitn_space_char, s, s.splitn(10, ' ').count());
make_test!(rsplitn_space_char, s, s.rsplitn(10, ' ').count());
make_test!(split_space_str, s, s.split(" ").count());
make_test!(split_ad_str, s, s.split("ad").count());
use std::iter::repeat;
use test::{black_box, Bencher};
#[bench]
fn bench_with_capacity(b: &mut Bencher) {
b.iter(|| String::with_capacity(100));
}
#[bench]
fn bench_push_str(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
b.iter(|| {
let mut r = String::new();
r.push_str(s);
});
}
const REPETITIONS: u64 = 10_000;
#[bench]
fn bench_push_str_one_byte(b: &mut Bencher) {
b.bytes = REPETITIONS;
b.iter(|| {
let mut r = String::new();
for _ in 0..REPETITIONS {
r.push_str("a")
}
});
}
#[bench]
fn bench_push_char_one_byte(b: &mut Bencher) {
b.bytes = REPETITIONS;
b.iter(|| {
let mut r = String::new();
for _ in 0..REPETITIONS {
r.push('a')
}
});
}
#[bench]
fn bench_push_char_two_bytes(b: &mut Bencher) {
b.bytes = REPETITIONS * 2;
b.iter(|| {
let mut r = String::new();
for _ in 0..REPETITIONS {
r.push('â')
}
});
}
#[bench]
fn from_utf8_lossy_100_ascii(b: &mut Bencher) {
let s = b"Hello there, the quick brown fox jumped over the lazy dog! \
Lorem ipsum dolor sit amet, consectetur. ";
assert_eq!(100, s.len());
b.iter(|| {
let _ = String::from_utf8_lossy(s);
});
}
#[bench]
fn from_utf8_lossy_100_multibyte(b: &mut Bencher) {
let s = "𐌀𐌖𐌋𐌄𐌑𐌉ปรدولة الكويتทศไทย中华𐍅𐌿𐌻𐍆𐌹𐌻𐌰".as_bytes();
assert_eq!(100, s.len());
b.iter(|| {
let _ = String::from_utf8_lossy(s);
});
}
#[bench]
fn from_utf8_lossy_invalid(b: &mut Bencher) {
let s = b"Hello\xC0\x80 There\xE6\x83 Goodbye";
b.iter(|| {
let _ = String::from_utf8_lossy(s);
});
}
#[bench]
fn from_utf8_lossy_100_invalid(b: &mut Bencher) {
let s = repeat(0xf5).take(100).collect::<Vec<_>>();
b.iter(|| {
let _ = String::from_utf8_lossy(&s);
});
}
#[bench]
fn bench_exact_size_shrink_to_fit(b: &mut Bencher) {
let s = "Hello there, the quick brown fox jumped over the lazy dog! \
Lorem ipsum dolor sit amet, consectetur. ";
// ensure our operation produces an exact-size string before we benchmark it
let mut r = String::with_capacity(s.len());
r.push_str(s);
assert_eq!(r.len(), r.capacity());
b.iter(|| {
let mut r = String::with_capacity(s.len());
r.push_str(s);
r.shrink_to_fit();
r
});
}
#[bench]
fn bench_from_str(b: &mut Bencher) {
let s = "Hello there, the quick brown fox jumped over the lazy dog! \
Lorem ipsum dolor sit amet, consectetur. ";
b.iter(|| String::from(s))
}
#[bench]
fn bench_from(b: &mut Bencher) {
let s = "Hello there, the quick brown fox jumped over the lazy dog! \
Lorem ipsum dolor sit amet, consectetur. ";
b.iter(|| String::from(s))
}
#[bench]
fn bench_to_string(b: &mut Bencher) {
let s = "Hello there, the quick brown fox jumped over the lazy dog! \
Lorem ipsum dolor sit amet, consectetur. ";
b.iter(|| s.to_string())
}
#[bench]
fn bench_insert_char_short(b: &mut Bencher) {
let s = "Hello, World!";
b.iter(|| {
let mut x = String::from(s);
black_box(&mut x).insert(6, black_box(' '));
x
})
}
#[bench]
fn bench_insert_char_long(b: &mut Bencher) {
let s = "Hello, World!";
b.iter(|| {
let mut x = String::from(s);
black_box(&mut x).insert(6, black_box('❤'));
x
})
}
#[bench]
fn bench_insert_str_short(b: &mut Bencher) {
let s = "Hello, World!";
b.iter(|| {
let mut x = String::from(s);
black_box(&mut x).insert_str(6, black_box(" "));
x
})
}
#[bench]
fn bench_insert_str_long(b: &mut Bencher) {
let s = "Hello, World!";
b.iter(|| {
let mut x = String::from(s);
black_box(&mut x).insert_str(6, black_box(" rustic "));
x
})
}
use rand::RngCore;
use std::iter::{repeat, FromIterator};
use test::{black_box, Bencher};
#[bench]
fn bench_new(b: &mut Bencher) {
b.iter(|| Vec::<u32>::new())
}
fn do_bench_with_capacity(b: &mut Bencher, src_len: usize) {
b.bytes = src_len as u64;
b.iter(|| Vec::<u32>::with_capacity(src_len))
}
#[bench]
fn bench_with_capacity_0000(b: &mut Bencher) {
do_bench_with_capacity(b, 0)
}
#[bench]
fn bench_with_capacity_0010(b: &mut Bencher) {
do_bench_with_capacity(b, 10)
}
#[bench]
fn bench_with_capacity_0100(b: &mut Bencher) {
do_bench_with_capacity(b, 100)
}
#[bench]
fn bench_with_capacity_1000(b: &mut Bencher) {
do_bench_with_capacity(b, 1000)
}
fn do_bench_from_fn(b: &mut Bencher, src_len: usize) {
b.bytes = src_len as u64;
b.iter(|| (0..src_len).collect::<Vec<_>>())
}
#[bench]
fn bench_from_fn_0000(b: &mut Bencher) {
do_bench_from_fn(b, 0)
}
#[bench]
fn bench_from_fn_0010(b: &mut Bencher) {
do_bench_from_fn(b, 10)
}
#[bench]
fn bench_from_fn_0100(b: &mut Bencher) {
do_bench_from_fn(b, 100)
}
#[bench]
fn bench_from_fn_1000(b: &mut Bencher) {
do_bench_from_fn(b, 1000)
}
fn do_bench_from_elem(b: &mut Bencher, src_len: usize) {
b.bytes = src_len as u64;
b.iter(|| repeat(5).take(src_len).collect::<Vec<usize>>())
}
#[bench]
fn bench_from_elem_0000(b: &mut Bencher) {
do_bench_from_elem(b, 0)
}
#[bench]
fn bench_from_elem_0010(b: &mut Bencher) {
do_bench_from_elem(b, 10)
}
#[bench]
fn bench_from_elem_0100(b: &mut Bencher) {
do_bench_from_elem(b, 100)
}
#[bench]
fn bench_from_elem_1000(b: &mut Bencher) {
do_bench_from_elem(b, 1000)
}
fn do_bench_from_slice(b: &mut Bencher, src_len: usize) {
let src: Vec<_> = FromIterator::from_iter(0..src_len);
b.bytes = src_len as u64;
b.iter(|| src.as_slice().to_vec());
}
#[bench]
fn bench_from_slice_0000(b: &mut Bencher) {
do_bench_from_slice(b, 0)
}
#[bench]
fn bench_from_slice_0010(b: &mut Bencher) {
do_bench_from_slice(b, 10)
}
#[bench]
fn bench_from_slice_0100(b: &mut Bencher) {
do_bench_from_slice(b, 100)
}
#[bench]
fn bench_from_slice_1000(b: &mut Bencher) {
do_bench_from_slice(b, 1000)
}
fn do_bench_from_iter(b: &mut Bencher, src_len: usize) {
let src: Vec<_> = FromIterator::from_iter(0..src_len);
b.bytes = src_len as u64;
b.iter(|| {
let dst: Vec<_> = FromIterator::from_iter(src.iter().cloned());
dst
});
}
#[bench]
fn bench_from_iter_0000(b: &mut Bencher) {
do_bench_from_iter(b, 0)
}
#[bench]
fn bench_from_iter_0010(b: &mut Bencher) {
do_bench_from_iter(b, 10)
}
#[bench]
fn bench_from_iter_0100(b: &mut Bencher) {
do_bench_from_iter(b, 100)
}
#[bench]
fn bench_from_iter_1000(b: &mut Bencher) {
do_bench_from_iter(b, 1000)
}
fn do_bench_extend(b: &mut Bencher, dst_len: usize, src_len: usize) {
let dst: Vec<_> = FromIterator::from_iter(0..dst_len);
let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
b.bytes = src_len as u64;
b.iter(|| {
let mut dst = dst.clone();
dst.extend(src.clone());
dst
});
}
#[bench]
fn bench_extend_0000_0000(b: &mut Bencher) {
do_bench_extend(b, 0, 0)
}
#[bench]
fn bench_extend_0000_0010(b: &mut Bencher) {
do_bench_extend(b, 0, 10)
}
#[bench]
fn bench_extend_0000_0100(b: &mut Bencher) {
do_bench_extend(b, 0, 100)
}
#[bench]
fn bench_extend_0000_1000(b: &mut Bencher) {
do_bench_extend(b, 0, 1000)
}
#[bench]
fn bench_extend_0010_0010(b: &mut Bencher) {
do_bench_extend(b, 10, 10)
}
#[bench]
fn bench_extend_0100_0100(b: &mut Bencher) {
do_bench_extend(b, 100, 100)
}
#[bench]
fn bench_extend_1000_1000(b: &mut Bencher) {
do_bench_extend(b, 1000, 1000)
}
fn do_bench_extend_from_slice(b: &mut Bencher, dst_len: usize, src_len: usize) {
let dst: Vec<_> = FromIterator::from_iter(0..dst_len);
let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
b.bytes = src_len as u64;
b.iter(|| {
let mut dst = dst.clone();
dst.extend_from_slice(&src);
dst
});
}
#[bench]
fn bench_extend_recycle(b: &mut Bencher) {
let mut data = vec![0; 1000];
b.iter(|| {
let tmp = std::mem::take(&mut data);
let mut to_extend = black_box(Vec::new());
to_extend.extend(tmp.into_iter());
data = black_box(to_extend);
});
black_box(data);
}
#[bench]
fn bench_extend_from_slice_0000_0000(b: &mut Bencher) {
do_bench_extend_from_slice(b, 0, 0)
}
#[bench]
fn bench_extend_from_slice_0000_0010(b: &mut Bencher) {
do_bench_extend_from_slice(b, 0, 10)
}
#[bench]
fn bench_extend_from_slice_0000_0100(b: &mut Bencher) {
do_bench_extend_from_slice(b, 0, 100)
}
#[bench]
fn bench_extend_from_slice_0000_1000(b: &mut Bencher) {
do_bench_extend_from_slice(b, 0, 1000)
}
#[bench]
fn bench_extend_from_slice_0010_0010(b: &mut Bencher) {
do_bench_extend_from_slice(b, 10, 10)
}
#[bench]
fn bench_extend_from_slice_0100_0100(b: &mut Bencher) {
do_bench_extend_from_slice(b, 100, 100)
}
#[bench]
fn bench_extend_from_slice_1000_1000(b: &mut Bencher) {
do_bench_extend_from_slice(b, 1000, 1000)
}
fn do_bench_clone(b: &mut Bencher, src_len: usize) {
let src: Vec<usize> = FromIterator::from_iter(0..src_len);
b.bytes = src_len as u64;
b.iter(|| src.clone());
}
#[bench]
fn bench_clone_0000(b: &mut Bencher) {
do_bench_clone(b, 0)
}
#[bench]
fn bench_clone_0010(b: &mut Bencher) {
do_bench_clone(b, 10)
}
#[bench]
fn bench_clone_0100(b: &mut Bencher) {
do_bench_clone(b, 100)
}
#[bench]
fn bench_clone_1000(b: &mut Bencher) {
do_bench_clone(b, 1000)
}
fn do_bench_clone_from(b: &mut Bencher, times: usize, dst_len: usize, src_len: usize) {
let dst: Vec<_> = FromIterator::from_iter(0..src_len);
let src: Vec<_> = FromIterator::from_iter(dst_len..dst_len + src_len);
b.bytes = (times * src_len) as u64;
b.iter(|| {
let mut dst = dst.clone();
for _ in 0..times {
dst.clone_from(&src);
dst = black_box(dst);
}
dst
});
}
#[bench]
fn bench_clone_from_01_0000_0000(b: &mut Bencher) {
do_bench_clone_from(b, 1, 0, 0)
}
#[bench]
fn bench_clone_from_01_0000_0010(b: &mut Bencher) {
do_bench_clone_from(b, 1, 0, 10)
}
#[bench]
fn bench_clone_from_01_0000_0100(b: &mut Bencher) {
do_bench_clone_from(b, 1, 0, 100)
}
#[bench]
fn bench_clone_from_01_0000_1000(b: &mut Bencher) {
do_bench_clone_from(b, 1, 0, 1000)
}
#[bench]
fn bench_clone_from_01_0010_0010(b: &mut Bencher) {
do_bench_clone_from(b, 1, 10, 10)
}
#[bench]
fn bench_clone_from_01_0100_0100(b: &mut Bencher) {
do_bench_clone_from(b, 1, 100, 100)
}
#[bench]
fn bench_clone_from_01_1000_1000(b: &mut Bencher) {
do_bench_clone_from(b, 1, 1000, 1000)
}
#[bench]
fn bench_clone_from_01_0010_0100(b: &mut Bencher) {
do_bench_clone_from(b, 1, 10, 100)
}
#[bench]
fn bench_clone_from_01_0100_1000(b: &mut Bencher) {
do_bench_clone_from(b, 1, 100, 1000)
}
#[bench]
fn bench_clone_from_01_0010_0000(b: &mut Bencher) {
do_bench_clone_from(b, 1, 10, 0)
}
#[bench]
fn bench_clone_from_01_0100_0010(b: &mut Bencher) {
do_bench_clone_from(b, 1, 100, 10)
}
#[bench]
fn bench_clone_from_01_1000_0100(b: &mut Bencher) {
do_bench_clone_from(b, 1, 1000, 100)
}
#[bench]
fn bench_clone_from_10_0000_0000(b: &mut Bencher) {
do_bench_clone_from(b, 10, 0, 0)
}
#[bench]
fn bench_clone_from_10_0000_0010(b: &mut Bencher) {
do_bench_clone_from(b, 10, 0, 10)
}
#[bench]
fn bench_clone_from_10_0000_0100(b: &mut Bencher) {
do_bench_clone_from(b, 10, 0, 100)
}
#[bench]
fn bench_clone_from_10_0000_1000(b: &mut Bencher) {
do_bench_clone_from(b, 10, 0, 1000)
}
#[bench]
fn bench_clone_from_10_0010_0010(b: &mut Bencher) {
do_bench_clone_from(b, 10, 10, 10)
}
#[bench]
fn bench_clone_from_10_0100_0100(b: &mut Bencher) {
do_bench_clone_from(b, 10, 100, 100)
}
#[bench]
fn bench_clone_from_10_1000_1000(b: &mut Bencher) {
do_bench_clone_from(b, 10, 1000, 1000)
}
#[bench]
fn bench_clone_from_10_0010_0100(b: &mut Bencher) {
do_bench_clone_from(b, 10, 10, 100)
}
#[bench]
fn bench_clone_from_10_0100_1000(b: &mut Bencher) {
do_bench_clone_from(b, 10, 100, 1000)
}
#[bench]
fn bench_clone_from_10_0010_0000(b: &mut Bencher) {
do_bench_clone_from(b, 10, 10, 0)
}
#[bench]
fn bench_clone_from_10_0100_0010(b: &mut Bencher) {
do_bench_clone_from(b, 10, 100, 10)
}
#[bench]
fn bench_clone_from_10_1000_0100(b: &mut Bencher) {
do_bench_clone_from(b, 10, 1000, 100)
}
macro_rules! bench_in_place {
($($fname:ident, $type:ty, $count:expr, $init:expr);*) => {
$(
#[bench]
fn $fname(b: &mut Bencher) {
b.iter(|| {
let src: Vec<$type> = black_box(vec![$init; $count]);
src.into_iter()
.enumerate()
.map(|(idx, e)| idx as $type ^ e)
.collect::<Vec<$type>>()
});
}
)+
};
}
bench_in_place![
bench_in_place_xxu8_0010_i0, u8, 10, 0;
bench_in_place_xxu8_0100_i0, u8, 100, 0;
bench_in_place_xxu8_1000_i0, u8, 1000, 0;
bench_in_place_xxu8_0010_i1, u8, 10, 1;
bench_in_place_xxu8_0100_i1, u8, 100, 1;
bench_in_place_xxu8_1000_i1, u8, 1000, 1;
bench_in_place_xu32_0010_i0, u32, 10, 0;
bench_in_place_xu32_0100_i0, u32, 100, 0;
bench_in_place_xu32_1000_i0, u32, 1000, 0;
bench_in_place_xu32_0010_i1, u32, 10, 1;
bench_in_place_xu32_0100_i1, u32, 100, 1;
bench_in_place_xu32_1000_i1, u32, 1000, 1;
bench_in_place_u128_0010_i0, u128, 10, 0;
bench_in_place_u128_0100_i0, u128, 100, 0;
bench_in_place_u128_1000_i0, u128, 1000, 0;
bench_in_place_u128_0010_i1, u128, 10, 1;
bench_in_place_u128_0100_i1, u128, 100, 1;
bench_in_place_u128_1000_i1, u128, 1000, 1
];
#[bench]
fn bench_in_place_recycle(b: &mut Bencher) {
let mut data = vec![0; 1000];
b.iter(|| {
let tmp = std::mem::take(&mut data);
data = black_box(
tmp.into_iter()
.enumerate()
.map(|(idx, e)| idx.wrapping_add(e))
.fuse()
.peekable()
.collect::<Vec<usize>>(),
);
});
}
#[bench]
fn bench_in_place_zip_recycle(b: &mut Bencher) {
let mut data = vec![0u8; 1000];
let mut rng = rand::thread_rng();
let mut subst = vec![0u8; 1000];
rng.fill_bytes(&mut subst[..]);
b.iter(|| {
let tmp = std::mem::take(&mut data);
let mangled = tmp
.into_iter()
.zip(subst.iter().copied())
.enumerate()
.map(|(i, (d, s))| d.wrapping_add(i as u8) ^ s)
.collect::<Vec<_>>();
data = black_box(mangled);
});
}
#[bench]
fn bench_in_place_zip_iter_mut(b: &mut Bencher) {
let mut data = vec![0u8; 256];
let mut rng = rand::thread_rng();
let mut subst = vec![0u8; 1000];
rng.fill_bytes(&mut subst[..]);
b.iter(|| {
data.iter_mut().enumerate().for_each(|(i, d)| {
*d = d.wrapping_add(i as u8) ^ subst[i];
});
});
black_box(data);
}
pub fn vec_cast<T, U>(input: Vec<T>) -> Vec<U> {
input.into_iter().map(|e| unsafe { std::mem::transmute_copy(&e) }).collect()
}
#[bench]
fn bench_transmute(b: &mut Bencher) {
let mut vec = vec![10u32; 100];
b.bytes = 800; // 2 casts x 4 bytes x 100
b.iter(|| {
let v = std::mem::take(&mut vec);
let v = black_box(vec_cast::<u32, i32>(v));
let v = black_box(vec_cast::<i32, u32>(v));
vec = v;
});
}
#[derive(Clone)]
struct Droppable(usize);
impl Drop for Droppable {
fn drop(&mut self) {
black_box(self);
}
}
#[bench]
fn bench_in_place_collect_droppable(b: &mut Bencher) {
let v: Vec<Droppable> = std::iter::repeat_with(|| Droppable(0)).take(1000).collect();
b.iter(|| {
v.clone()
.into_iter()
.skip(100)
.enumerate()
.map(|(i, e)| Droppable(i ^ e.0))
.collect::<Vec<_>>()
})
}
const LEN: usize = 16384;
#[bench]
fn bench_chain_collect(b: &mut Bencher) {
let data = black_box([0; LEN]);
b.iter(|| data.iter().cloned().chain([1].iter().cloned()).collect::<Vec<_>>());
}
#[bench]
fn bench_chain_chain_collect(b: &mut Bencher) {
let data = black_box([0; LEN]);
b.iter(|| {
data.iter()
.cloned()
.chain([1].iter().cloned())
.chain([2].iter().cloned())
.collect::<Vec<_>>()
});
}
#[bench]
fn bench_nest_chain_chain_collect(b: &mut Bencher) {
let data = black_box([0; LEN]);
b.iter(|| {
data.iter().cloned().chain([1].iter().chain([2].iter()).cloned()).collect::<Vec<_>>()
});
}
#[bench]
fn bench_range_map_collect(b: &mut Bencher) {
b.iter(|| (0..LEN).map(|_| u32::default()).collect::<Vec<_>>());
}
#[bench]
fn bench_chain_extend_ref(b: &mut Bencher) {
let data = black_box([0; LEN]);
b.iter(|| {
let mut v = Vec::<u32>::with_capacity(data.len() + 1);
v.extend(data.iter().chain([1].iter()));
v
});
}
#[bench]
fn bench_chain_extend_value(b: &mut Bencher) {
let data = black_box([0; LEN]);
b.iter(|| {
let mut v = Vec::<u32>::with_capacity(data.len() + 1);
v.extend(data.iter().cloned().chain(Some(1)));
v
});
}
#[bench]
fn bench_rev_1(b: &mut Bencher) {
let data = black_box([0; LEN]);
b.iter(|| {
let mut v = Vec::<u32>::new();
v.extend(data.iter().rev());
v
});
}
#[bench]
fn bench_rev_2(b: &mut Bencher) {
let data = black_box([0; LEN]);
b.iter(|| {
let mut v = Vec::<u32>::with_capacity(data.len());
v.extend(data.iter().rev());
v
});
}
#[bench]
fn bench_map_regular(b: &mut Bencher) {
let data = black_box([(0, 0); LEN]);
b.iter(|| {
let mut v = Vec::<u32>::new();
v.extend(data.iter().map(|t| t.1));
v
});
}
#[bench]
fn bench_map_fast(b: &mut Bencher) {
let data = black_box([(0, 0); LEN]);
b.iter(|| {
let mut result = Vec::with_capacity(data.len());
for i in 0..data.len() {
unsafe {
*result.get_unchecked_mut(i) = data[i].0;
result.set_len(i);
}
}
result
});
}
fn random_sorted_fill(mut seed: u32, buf: &mut [u32]) {
let mask = if buf.len() < 8192 {
0xFF
} else if buf.len() < 200_000 {
0xFFFF
} else {
0xFFFF_FFFF
};
for item in buf.iter_mut() {
seed ^= seed << 13;
seed ^= seed >> 17;
seed ^= seed << 5;
*item = seed & mask;
}
buf.sort();
}
fn bench_vec_dedup_old(b: &mut Bencher, sz: usize) {
let mut template = vec![0u32; sz];
b.bytes = std::mem::size_of_val(template.as_slice()) as u64;
random_sorted_fill(0x43, &mut template);
let mut vec = template.clone();
b.iter(|| {
let len = {
let (dedup, _) = vec.partition_dedup();
dedup.len()
};
vec.truncate(len);
black_box(vec.first());
vec.clear();
vec.extend_from_slice(&template);
});
}
fn bench_vec_dedup_new(b: &mut Bencher, sz: usize) {
let mut template = vec![0u32; sz];
b.bytes = std::mem::size_of_val(template.as_slice()) as u64;
random_sorted_fill(0x43, &mut template);
let mut vec = template.clone();
b.iter(|| {
vec.dedup();
black_box(vec.first());
vec.clear();
vec.extend_from_slice(&template);
});
}
#[bench]
fn bench_dedup_old_100(b: &mut Bencher) {
bench_vec_dedup_old(b, 100);
}
#[bench]
fn bench_dedup_new_100(b: &mut Bencher) {
bench_vec_dedup_new(b, 100);
}
#[bench]
fn bench_dedup_old_1000(b: &mut Bencher) {
bench_vec_dedup_old(b, 1000);
}
#[bench]
fn bench_dedup_new_1000(b: &mut Bencher) {
bench_vec_dedup_new(b, 1000);
}
#[bench]
fn bench_dedup_old_10000(b: &mut Bencher) {
bench_vec_dedup_old(b, 10000);
}
#[bench]
fn bench_dedup_new_10000(b: &mut Bencher) {
bench_vec_dedup_new(b, 10000);
}
#[bench]
fn bench_dedup_old_100000(b: &mut Bencher) {
bench_vec_dedup_old(b, 100000);
}
#[bench]
fn bench_dedup_new_100000(b: &mut Bencher) {
bench_vec_dedup_new(b, 100000);
}
// Disabling on android for the time being
// See https://github.com/rust-lang/rust/issues/73535#event-3477699747
#![cfg(not(target_os = "android"))]
#![feature(btree_drain_filter)]
#![feature(map_first_last)]
#![feature(repr_simd)]
#![feature(slice_partition_dedup)]
#![feature(test)]
extern crate test;
mod binary_heap;
mod btree;
mod linked_list;
mod slice;
mod str;
mod string;
mod vec;
mod vec_deque;
use std::collections::BTreeMap;
use std::iter::Iterator;
use std::ops::RangeBounds;
use std::vec::Vec;
use rand::{seq::SliceRandom, thread_rng, Rng};
use test::{black_box, Bencher};
macro_rules! map_insert_rand_bench {
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let n: usize = $n;
let mut map = $map::new();
// setup
let mut rng = thread_rng();
for _ in 0..n {
let i = rng.gen::<usize>() % n;
map.insert(i, i);
}
// measure
b.iter(|| {
let k = rng.gen::<usize>() % n;
map.insert(k, k);
map.remove(&k);
});
black_box(map);
}
};
}
macro_rules! map_insert_seq_bench {
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let mut map = $map::new();
let n: usize = $n;
// setup
for i in 0..n {
map.insert(i * 2, i * 2);
}
// measure
let mut i = 1;
b.iter(|| {
map.insert(i, i);
map.remove(&i);
i = (i + 2) % n;
});
black_box(map);
}
};
}
macro_rules! map_find_rand_bench {
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let mut map = $map::new();
let n: usize = $n;
// setup
let mut rng = thread_rng();
let mut keys: Vec<_> = (0..n).map(|_| rng.gen::<usize>() % n).collect();
for &k in &keys {
map.insert(k, k);
}
keys.shuffle(&mut rng);
// measure
let mut i = 0;
b.iter(|| {
let t = map.get(&keys[i]);
i = (i + 1) % n;
black_box(t);
})
}
};
}
macro_rules! map_find_seq_bench {
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let mut map = $map::new();
let n: usize = $n;
// setup
for i in 0..n {
map.insert(i, i);
}
// measure
let mut i = 0;
b.iter(|| {
let x = map.get(&i);
i = (i + 1) % n;
black_box(x);
})
}
};
}
map_insert_rand_bench! {insert_rand_100, 100, BTreeMap}
map_insert_rand_bench! {insert_rand_10_000, 10_000, BTreeMap}
map_insert_seq_bench! {insert_seq_100, 100, BTreeMap}
map_insert_seq_bench! {insert_seq_10_000, 10_000, BTreeMap}
map_find_rand_bench! {find_rand_100, 100, BTreeMap}
map_find_rand_bench! {find_rand_10_000, 10_000, BTreeMap}
map_find_seq_bench! {find_seq_100, 100, BTreeMap}
map_find_seq_bench! {find_seq_10_000, 10_000, BTreeMap}
fn bench_iteration(b: &mut Bencher, size: i32) {
let mut map = BTreeMap::<i32, i32>::new();
let mut rng = thread_rng();
for _ in 0..size {
map.insert(rng.gen(), rng.gen());
}
b.iter(|| {
for entry in &map {
black_box(entry);
}
});
}
#[bench]
pub fn iteration_20(b: &mut Bencher) {
bench_iteration(b, 20);
}
#[bench]
pub fn iteration_1000(b: &mut Bencher) {
bench_iteration(b, 1000);
}
#[bench]
pub fn iteration_100000(b: &mut Bencher) {
bench_iteration(b, 100000);
}
fn bench_iteration_mut(b: &mut Bencher, size: i32) {
let mut map = BTreeMap::<i32, i32>::new();
let mut rng = thread_rng();
for _ in 0..size {
map.insert(rng.gen(), rng.gen());
}
b.iter(|| {
for kv in map.iter_mut() {
black_box(kv);
}
});
}
#[bench]
pub fn iteration_mut_20(b: &mut Bencher) {
bench_iteration_mut(b, 20);
}
#[bench]
pub fn iteration_mut_1000(b: &mut Bencher) {
bench_iteration_mut(b, 1000);
}
#[bench]
pub fn iteration_mut_100000(b: &mut Bencher) {
bench_iteration_mut(b, 100000);
}
fn bench_first_and_last(b: &mut Bencher, size: i32) {
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
b.iter(|| {
for _ in 0..10 {
black_box(map.first_key_value());
black_box(map.last_key_value());
}
});
}
#[bench]
pub fn first_and_last_0(b: &mut Bencher) {
bench_first_and_last(b, 0);
}
#[bench]
pub fn first_and_last_100(b: &mut Bencher) {
bench_first_and_last(b, 100);
}
#[bench]
pub fn first_and_last_10k(b: &mut Bencher) {
bench_first_and_last(b, 10_000);
}
const BENCH_RANGE_SIZE: i32 = 145;
const BENCH_RANGE_COUNT: i32 = BENCH_RANGE_SIZE * (BENCH_RANGE_SIZE - 1) / 2;
fn bench_range<F, R>(b: &mut Bencher, f: F)
where
F: Fn(i32, i32) -> R,
R: RangeBounds<i32>,
{
let map: BTreeMap<_, _> = (0..BENCH_RANGE_SIZE).map(|i| (i, i)).collect();
b.iter(|| {
let mut c = 0;
for i in 0..BENCH_RANGE_SIZE {
for j in i + 1..BENCH_RANGE_SIZE {
black_box(map.range(f(i, j)));
c += 1;
}
}
debug_assert_eq!(c, BENCH_RANGE_COUNT);
});
}
#[bench]
pub fn range_included_excluded(b: &mut Bencher) {
bench_range(b, |i, j| i..j);
}
#[bench]
pub fn range_included_included(b: &mut Bencher) {
bench_range(b, |i, j| i..=j);
}
#[bench]
pub fn range_included_unbounded(b: &mut Bencher) {
bench_range(b, |i, _| i..);
}
#[bench]
pub fn range_unbounded_unbounded(b: &mut Bencher) {
bench_range(b, |_, _| ..);
}
fn bench_iter(b: &mut Bencher, repeats: i32, size: i32) {
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
b.iter(|| {
for _ in 0..repeats {
black_box(map.iter());
}
});
}
/// Contrast range_unbounded_unbounded with `iter()`.
#[bench]
pub fn range_unbounded_vs_iter(b: &mut Bencher) {
bench_iter(b, BENCH_RANGE_COUNT, BENCH_RANGE_SIZE);
}
#[bench]
pub fn iter_0(b: &mut Bencher) {
bench_iter(b, 1_000, 0);
}
#[bench]
pub fn iter_1(b: &mut Bencher) {
bench_iter(b, 1_000, 1);
}
#[bench]
pub fn iter_100(b: &mut Bencher) {
bench_iter(b, 1_000, 100);
}
#[bench]
pub fn iter_10k(b: &mut Bencher) {
bench_iter(b, 1_000, 10_000);
}
#[bench]
pub fn iter_1m(b: &mut Bencher) {
bench_iter(b, 1_000, 1_000_000);
}
const FAT: usize = 256;
// The returned map has small keys and values.
// Benchmarks on it have a counterpart in set.rs with the same keys and no values at all.
fn slim_map(n: usize) -> BTreeMap<usize, usize> {
(0..n).map(|i| (i, i)).collect::<BTreeMap<_, _>>()
}
// The returned map has small keys and large values.
fn fat_val_map(n: usize) -> BTreeMap<usize, [usize; FAT]> {
(0..n).map(|i| (i, [i; FAT])).collect::<BTreeMap<_, _>>()
}
#[bench]
pub fn clone_slim_100(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_slim_100_and_clear(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_slim_100_and_drain_all(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| src.clone().drain_filter(|_, _| true).count())
}
#[bench]
pub fn clone_slim_100_and_drain_half(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| {
let mut map = src.clone();
assert_eq!(map.drain_filter(|i, _| i % 2 == 0).count(), 100 / 2);
assert_eq!(map.len(), 100 / 2);
})
}
#[bench]
pub fn clone_slim_100_and_into_iter(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_slim_100_and_pop_all(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| {
let mut map = src.clone();
while map.pop_first().is_some() {}
map
});
}
#[bench]
pub fn clone_slim_100_and_remove_all(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| {
let mut map = src.clone();
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
let v = map.remove(&elt);
debug_assert!(v.is_some());
}
map
});
}
#[bench]
pub fn clone_slim_100_and_remove_half(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| {
let mut map = src.clone();
for i in (0..100).step_by(2) {
let v = map.remove(&i);
debug_assert!(v.is_some());
}
assert_eq!(map.len(), 100 / 2);
map
})
}
#[bench]
pub fn clone_slim_10k(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_slim_10k_and_clear(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_slim_10k_and_drain_all(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| src.clone().drain_filter(|_, _| true).count())
}
#[bench]
pub fn clone_slim_10k_and_drain_half(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| {
let mut map = src.clone();
assert_eq!(map.drain_filter(|i, _| i % 2 == 0).count(), 10_000 / 2);
assert_eq!(map.len(), 10_000 / 2);
})
}
#[bench]
pub fn clone_slim_10k_and_into_iter(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_slim_10k_and_pop_all(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| {
let mut map = src.clone();
while map.pop_first().is_some() {}
map
});
}
#[bench]
pub fn clone_slim_10k_and_remove_all(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| {
let mut map = src.clone();
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
let v = map.remove(&elt);
debug_assert!(v.is_some());
}
map
});
}
#[bench]
pub fn clone_slim_10k_and_remove_half(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| {
let mut map = src.clone();
for i in (0..10_000).step_by(2) {
let v = map.remove(&i);
debug_assert!(v.is_some());
}
assert_eq!(map.len(), 10_000 / 2);
map
})
}
#[bench]
pub fn clone_fat_val_100(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_fat_val_100_and_clear(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_fat_val_100_and_drain_all(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| src.clone().drain_filter(|_, _| true).count())
}
#[bench]
pub fn clone_fat_val_100_and_drain_half(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| {
let mut map = src.clone();
assert_eq!(map.drain_filter(|i, _| i % 2 == 0).count(), 100 / 2);
assert_eq!(map.len(), 100 / 2);
})
}
#[bench]
pub fn clone_fat_val_100_and_into_iter(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_fat_val_100_and_pop_all(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| {
let mut map = src.clone();
while map.pop_first().is_some() {}
map
});
}
#[bench]
pub fn clone_fat_val_100_and_remove_all(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| {
let mut map = src.clone();
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
let v = map.remove(&elt);
debug_assert!(v.is_some());
}
map
});
}
#[bench]
pub fn clone_fat_val_100_and_remove_half(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| {
let mut map = src.clone();
for i in (0..100).step_by(2) {
let v = map.remove(&i);
debug_assert!(v.is_some());
}
assert_eq!(map.len(), 100 / 2);
map
})
}
use std::collections::BTreeSet;
use rand::{thread_rng, Rng};
use test::Bencher;
fn random(n: usize) -> BTreeSet<usize> {
let mut rng = thread_rng();
let mut set = BTreeSet::new();
while set.len() < n {
set.insert(rng.gen());
}
assert_eq!(set.len(), n);
set
}
fn neg(n: usize) -> BTreeSet<i32> {
let set: BTreeSet<i32> = (-(n as i32)..=-1).collect();
assert_eq!(set.len(), n);
set
}
fn pos(n: usize) -> BTreeSet<i32> {
let set: BTreeSet<i32> = (1..=(n as i32)).collect();
assert_eq!(set.len(), n);
set
}
fn stagger(n1: usize, factor: usize) -> [BTreeSet<u32>; 2] {
let n2 = n1 * factor;
let mut sets = [BTreeSet::new(), BTreeSet::new()];
for i in 0..(n1 + n2) {
let b = i % (factor + 1) != 0;
sets[b as usize].insert(i as u32);
}
assert_eq!(sets[0].len(), n1);
assert_eq!(sets[1].len(), n2);
sets
}
macro_rules! set_bench {
($name: ident, $set_func: ident, $result_func: ident, $sets: expr) => {
#[bench]
pub fn $name(b: &mut Bencher) {
// setup
let sets = $sets;
// measure
b.iter(|| sets[0].$set_func(&sets[1]).$result_func())
}
};
}
fn slim_set(n: usize) -> BTreeSet<usize> {
(0..n).collect::<BTreeSet<_>>()
}
#[bench]
pub fn clone_100(b: &mut Bencher) {
let src = slim_set(100);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_100_and_clear(b: &mut Bencher) {
let src = slim_set(100);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_100_and_drain_all(b: &mut Bencher) {
let src = slim_set(100);
b.iter(|| src.clone().drain_filter(|_| true).count())
}
#[bench]
pub fn clone_100_and_drain_half(b: &mut Bencher) {
let src = slim_set(100);
b.iter(|| {
let mut set = src.clone();
assert_eq!(set.drain_filter(|i| i % 2 == 0).count(), 100 / 2);
assert_eq!(set.len(), 100 / 2);
})
}
#[bench]
pub fn clone_100_and_into_iter(b: &mut Bencher) {
let src = slim_set(100);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_100_and_pop_all(b: &mut Bencher) {
let src = slim_set(100);
b.iter(|| {
let mut set = src.clone();
while set.pop
gitextract_y3u5cs40/
├── .github/
│ ├── FUNDING.yml
│ ├── dependabot.yml
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .ignore
├── .vim/
│ └── coc-settings.json
├── COPYING
├── Cargo.toml
├── LICENSE-MIT
├── README.md
├── UNLICENSE
├── benchmarks/
│ ├── definitions/
│ │ ├── memchr/
│ │ │ └── sherlock/
│ │ │ ├── common.toml
│ │ │ ├── never.toml
│ │ │ ├── rare.toml
│ │ │ ├── uncommon.toml
│ │ │ └── verycommon.toml
│ │ └── memmem/
│ │ ├── byterank.toml
│ │ ├── code.toml
│ │ ├── pathological.toml
│ │ ├── sliceslice.toml
│ │ └── subtitles/
│ │ ├── common.toml
│ │ ├── never.toml
│ │ └── rare.toml
│ ├── engines/
│ │ ├── .gitignore
│ │ ├── libc/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-bytecount/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-jetscii/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-memchr/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-memchrold/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-sliceslice/
│ │ │ ├── Cargo.toml
│ │ │ └── main.rs
│ │ ├── rust-std/
│ │ │ ├── Cargo.toml
│ │ │ ├── build.rs
│ │ │ └── main.rs
│ │ └── stringzilla/
│ │ ├── Cargo.toml
│ │ └── main.rs
│ ├── engines.toml
│ ├── haystacks/
│ │ ├── README.md
│ │ ├── code/
│ │ │ ├── README.md
│ │ │ └── rust-library.rs
│ │ ├── opensubtitles/
│ │ │ ├── README.md
│ │ │ ├── en-huge.txt
│ │ │ ├── en-medium.txt
│ │ │ ├── en-small.txt
│ │ │ ├── en-teeny.txt
│ │ │ ├── en-tiny.txt
│ │ │ ├── ru-huge.txt
│ │ │ ├── ru-medium.txt
│ │ │ ├── ru-small.txt
│ │ │ ├── ru-teeny.txt
│ │ │ ├── ru-tiny.txt
│ │ │ ├── zh-huge.txt
│ │ │ ├── zh-medium.txt
│ │ │ ├── zh-small.txt
│ │ │ ├── zh-teeny.txt
│ │ │ └── zh-tiny.txt
│ │ ├── pathological/
│ │ │ ├── README.md
│ │ │ ├── defeat-simple-vector-freq.txt
│ │ │ ├── defeat-simple-vector-repeated.txt
│ │ │ ├── defeat-simple-vector.txt
│ │ │ ├── md5-huge.txt
│ │ │ ├── random-huge.txt
│ │ │ ├── repeated-rare-huge.txt
│ │ │ └── repeated-rare-small.txt
│ │ ├── rg-13.0.0.txt
│ │ ├── sherlock/
│ │ │ ├── README.md
│ │ │ ├── huge.txt
│ │ │ ├── small.txt
│ │ │ └── tiny.txt
│ │ └── sliceslice/
│ │ ├── README.md
│ │ ├── haystack.txt
│ │ ├── i386-notutf8.txt
│ │ └── i386.txt
│ ├── record/
│ │ ├── aarch64/
│ │ │ ├── 2023-08-17.csv
│ │ │ ├── 2023-08-20.csv
│ │ │ ├── 2023-08-24.csv
│ │ │ ├── 2023-08-24_2.csv
│ │ │ ├── 2023-08-26.csv
│ │ │ ├── 2023-08-27.csv
│ │ │ └── 2023-12-29.csv
│ │ └── x86_64/
│ │ ├── 2023-07-31_baseline.csv
│ │ ├── 2023-08-07.csv
│ │ ├── 2023-08-09.csv
│ │ ├── 2023-08-15.csv
│ │ ├── 2023-08-17.csv
│ │ ├── 2023-08-20.csv
│ │ ├── 2023-08-23.csv
│ │ ├── 2023-08-24.csv
│ │ ├── 2023-08-24_2.csv
│ │ ├── 2023-08-25.csv
│ │ ├── 2023-08-26.csv
│ │ ├── 2023-08-27.csv
│ │ ├── 2023-12-29.csv
│ │ └── 2025-09-25.csv
│ ├── regexes/
│ │ ├── sliceslice/
│ │ │ ├── README.md
│ │ │ ├── words-by-length-desc.txt
│ │ │ └── words.txt
│ │ └── zero-zero-dd-dd.txt
│ └── shared/
│ ├── Cargo.toml
│ └── lib.rs
├── fuzz/
│ ├── .gitignore
│ ├── Cargo.toml
│ └── fuzz_targets/
│ ├── memchr.rs
│ ├── memchr2.rs
│ ├── memchr3.rs
│ ├── memmem.rs
│ ├── memrchr.rs
│ ├── memrchr2.rs
│ ├── memrchr3.rs
│ └── memrmem.rs
├── rustfmt.toml
├── scripts/
│ └── make-byte-frequency-table
└── src/
├── arch/
│ ├── aarch64/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── neon/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── packedpair.rs
│ ├── all/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ ├── packedpair/
│ │ │ ├── default_rank.rs
│ │ │ └── mod.rs
│ │ ├── rabinkarp.rs
│ │ ├── shiftor.rs
│ │ └── twoway.rs
│ ├── generic/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── packedpair.rs
│ ├── mod.rs
│ ├── wasm32/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── simd128/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── packedpair.rs
│ └── x86_64/
│ ├── avx2/
│ │ ├── memchr.rs
│ │ ├── mod.rs
│ │ └── packedpair.rs
│ ├── memchr.rs
│ ├── mod.rs
│ └── sse2/
│ ├── memchr.rs
│ ├── mod.rs
│ └── packedpair.rs
├── cow.rs
├── ext.rs
├── lib.rs
├── macros.rs
├── memchr.rs
├── memmem/
│ ├── mod.rs
│ └── searcher.rs
├── tests/
│ ├── memchr/
│ │ ├── mod.rs
│ │ ├── naive.rs
│ │ └── prop.rs
│ ├── mod.rs
│ ├── packedpair.rs
│ └── substring/
│ ├── mod.rs
│ ├── naive.rs
│ └── prop.rs
└── vector.rs
Showing preview only (297K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3866 symbols across 45 files)
FILE: benchmarks/engines/libc/main.rs
function main (line 5) | fn main() -> anyhow::Result<()> {
function memchr_oneshot_count (line 33) | fn memchr_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_oneshot_count (line 39) | fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function libc_memchr (line 47) | fn libc_memchr(haystack: &[u8], needle: u8) -> Option<usize> {
function libc_memmem (line 65) | fn libc_memmem(haystack: &[u8], needle: &[u8]) -> Option<usize> {
FILE: benchmarks/engines/rust-bytecount/main.rs
function main (line 5) | fn main() -> anyhow::Result<()> {
function memchr_oneshot_count (line 31) | fn memchr_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
FILE: benchmarks/engines/rust-jetscii/main.rs
function main (line 5) | fn main() -> anyhow::Result<()> {
function memmem_prebuilt_count (line 32) | fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_oneshot_count (line 41) | fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
FILE: benchmarks/engines/rust-memchr/main.rs
function main (line 7) | fn main() -> anyhow::Result<()> {
function memchr_oneshot_count (line 66) | fn memchr_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr_prebuilt_count (line 76) | fn memchr_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr_only_count (line 82) | fn memchr_only_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr_fallback_count (line 88) | fn memchr_fallback_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr_naive_count (line 95) | fn memchr_naive_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr2_count (line 105) | fn memchr2_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr2_fallback_count (line 111) | fn memchr2_fallback_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr2_naive_count (line 118) | fn memchr2_naive_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr3_count (line 128) | fn memchr3_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr3_fallback_count (line 136) | fn memchr3_fallback_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr3_naive_count (line 143) | fn memchr3_naive_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memrchr_count (line 153) | fn memrchr_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memrchr2_count (line 161) | fn memrchr2_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memrchr3_count (line 169) | fn memrchr3_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_count (line 177) | fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_needles (line 184) | fn memmem_prebuilt_needles(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_haystack (line 203) | fn memmem_prebuilt_haystack(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_oneshot_count (line 221) | fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_binary_count (line 228) | fn memmem_binary_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_twoway_count (line 236) | fn memmem_twoway_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_rabinkarp_count (line 245) | fn memmem_rabinkarp_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_shiftor_count (line 254) | fn memmem_shiftor_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
type Binary (line 266) | struct Binary;
method rank (line 269) | fn rank(&self, byte: u8) -> u8 {
type IteratorExt (line 290) | trait IteratorExt: Iterator {
method count_slow (line 297) | fn count_slow(mut self) -> usize
FILE: benchmarks/engines/rust-memchrold/main.rs
function main (line 5) | fn main() -> anyhow::Result<()> {
function memchr_oneshot_count (line 54) | fn memchr_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr_prebuilt_count (line 64) | fn memchr_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr_naive_count (line 70) | fn memchr_naive_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr2_count (line 80) | fn memchr2_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memchr3_count (line 86) | fn memchr3_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memrchr_count (line 92) | fn memrchr_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memrchr2_count (line 98) | fn memrchr2_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memrchr3_count (line 104) | fn memrchr3_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_count (line 112) | fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_needles (line 119) | fn memmem_prebuilt_needles(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_haystack (line 138) | fn memmem_prebuilt_haystack(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_oneshot_count (line 156) | fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
FILE: benchmarks/engines/rust-sliceslice/main.rs
function main (line 5) | fn main() -> anyhow::Result<()> {
function memmem_prebuilt_count (line 46) | fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_needles (line 83) | fn memmem_prebuilt_needles(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_haystack (line 144) | fn memmem_prebuilt_haystack(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_oneshot_count (line 203) | fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
FILE: benchmarks/engines/rust-std/build.rs
function main (line 5) | fn main() {
function rustc_version (line 10) | fn rustc_version() -> Option<String> {
FILE: benchmarks/engines/rust-std/main.rs
function main (line 5) | fn main() -> anyhow::Result<()> {
function memmem_oneshot_count (line 32) | fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
function memmem_prebuilt_count (line 58) | fn memmem_prebuilt_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
FILE: benchmarks/engines/stringzilla/main.rs
function main (line 7) | fn main() -> anyhow::Result<()> {
function memmem_oneshot_count (line 33) | fn memmem_oneshot_count(b: &Benchmark) -> anyhow::Result<Vec<Sample>> {
FILE: benchmarks/haystacks/code/rust-library.rs
function bench_collect_into (line 5) | fn bench_collect_into(b: &mut Bencher) {
function bench_push_front (line 13) | fn bench_push_front(b: &mut Bencher) {
function bench_push_back (line 21) | fn bench_push_back(b: &mut Bencher) {
function bench_push_back_pop_back (line 29) | fn bench_push_back_pop_back(b: &mut Bencher) {
function bench_push_front_pop_front (line 38) | fn bench_push_front_pop_front(b: &mut Bencher) {
function bench_iter (line 47) | fn bench_iter(b: &mut Bencher) {
function bench_iter_mut (line 55) | fn bench_iter_mut(b: &mut Bencher) {
function bench_iter_rev (line 63) | fn bench_iter_rev(b: &mut Bencher) {
function bench_iter_mut_rev (line 71) | fn bench_iter_mut_rev(b: &mut Bencher) {
function char_iterator (line 81) | fn char_iterator(b: &mut Bencher) {
function char_iterator_for (line 88) | fn char_iterator_for(b: &mut Bencher) {
function char_iterator_ascii (line 99) | fn char_iterator_ascii(b: &mut Bencher) {
function char_iterator_rev (line 111) | fn char_iterator_rev(b: &mut Bencher) {
function char_iterator_rev_for (line 118) | fn char_iterator_rev_for(b: &mut Bencher) {
function char_indicesator (line 129) | fn char_indicesator(b: &mut Bencher) {
function char_indicesator_rev (line 137) | fn char_indicesator_rev(b: &mut Bencher) {
function split_unicode_ascii (line 145) | fn split_unicode_ascii(b: &mut Bencher) {
function split_ascii (line 152) | fn split_ascii(b: &mut Bencher) {
function split_extern_fn (line 160) | fn split_extern_fn(b: &mut Bencher) {
function split_closure (line 171) | fn split_closure(b: &mut Bencher) {
function split_slice (line 179) | fn split_slice(b: &mut Bencher) {
function bench_join (line 188) | fn bench_join(b: &mut Bencher) {
function bench_contains_short_short (line 198) | fn bench_contains_short_short(b: &mut Bencher) {
function bench_contains_short_long (line 208) | fn bench_contains_short_long(b: &mut Bencher) {
function bench_contains_bad_naive (line 252) | fn bench_contains_bad_naive(b: &mut Bencher) {
function bench_contains_equal (line 262) | fn bench_contains_equal(b: &mut Bencher) {
function bench_with_capacity (line 381) | fn bench_with_capacity(b: &mut Bencher) {
function bench_push_str (line 386) | fn bench_push_str(b: &mut Bencher) {
constant REPETITIONS (line 394) | const REPETITIONS: u64 = 10_000;
function bench_push_str_one_byte (line 397) | fn bench_push_str_one_byte(b: &mut Bencher) {
function bench_push_char_one_byte (line 408) | fn bench_push_char_one_byte(b: &mut Bencher) {
function bench_push_char_two_bytes (line 419) | fn bench_push_char_two_bytes(b: &mut Bencher) {
function from_utf8_lossy_100_ascii (line 430) | fn from_utf8_lossy_100_ascii(b: &mut Bencher) {
function from_utf8_lossy_100_multibyte (line 441) | fn from_utf8_lossy_100_multibyte(b: &mut Bencher) {
function from_utf8_lossy_invalid (line 450) | fn from_utf8_lossy_invalid(b: &mut Bencher) {
function from_utf8_lossy_100_invalid (line 458) | fn from_utf8_lossy_100_invalid(b: &mut Bencher) {
function bench_exact_size_shrink_to_fit (line 466) | fn bench_exact_size_shrink_to_fit(b: &mut Bencher) {
function bench_from_str (line 482) | fn bench_from_str(b: &mut Bencher) {
function bench_from (line 489) | fn bench_from(b: &mut Bencher) {
function bench_to_string (line 496) | fn bench_to_string(b: &mut Bencher) {
function bench_insert_char_short (line 503) | fn bench_insert_char_short(b: &mut Bencher) {
function bench_insert_char_long (line 513) | fn bench_insert_char_long(b: &mut Bencher) {
function bench_insert_str_short (line 523) | fn bench_insert_str_short(b: &mut Bencher) {
function bench_insert_str_long (line 533) | fn bench_insert_str_long(b: &mut Bencher) {
function bench_new (line 546) | fn bench_new(b: &mut Bencher) {
function do_bench_with_capacity (line 550) | fn do_bench_with_capacity(b: &mut Bencher, src_len: usize) {
function bench_with_capacity_0000 (line 557) | fn bench_with_capacity_0000(b: &mut Bencher) {
function bench_with_capacity_0010 (line 562) | fn bench_with_capacity_0010(b: &mut Bencher) {
function bench_with_capacity_0100 (line 567) | fn bench_with_capacity_0100(b: &mut Bencher) {
function bench_with_capacity_1000 (line 572) | fn bench_with_capacity_1000(b: &mut Bencher) {
function do_bench_from_fn (line 576) | fn do_bench_from_fn(b: &mut Bencher, src_len: usize) {
function bench_from_fn_0000 (line 583) | fn bench_from_fn_0000(b: &mut Bencher) {
function bench_from_fn_0010 (line 588) | fn bench_from_fn_0010(b: &mut Bencher) {
function bench_from_fn_0100 (line 593) | fn bench_from_fn_0100(b: &mut Bencher) {
function bench_from_fn_1000 (line 598) | fn bench_from_fn_1000(b: &mut Bencher) {
function do_bench_from_elem (line 602) | fn do_bench_from_elem(b: &mut Bencher, src_len: usize) {
function bench_from_elem_0000 (line 609) | fn bench_from_elem_0000(b: &mut Bencher) {
function bench_from_elem_0010 (line 614) | fn bench_from_elem_0010(b: &mut Bencher) {
function bench_from_elem_0100 (line 619) | fn bench_from_elem_0100(b: &mut Bencher) {
function bench_from_elem_1000 (line 624) | fn bench_from_elem_1000(b: &mut Bencher) {
function do_bench_from_slice (line 628) | fn do_bench_from_slice(b: &mut Bencher, src_len: usize) {
function bench_from_slice_0000 (line 637) | fn bench_from_slice_0000(b: &mut Bencher) {
function bench_from_slice_0010 (line 642) | fn bench_from_slice_0010(b: &mut Bencher) {
function bench_from_slice_0100 (line 647) | fn bench_from_slice_0100(b: &mut Bencher) {
function bench_from_slice_1000 (line 652) | fn bench_from_slice_1000(b: &mut Bencher) {
function do_bench_from_iter (line 656) | fn do_bench_from_iter(b: &mut Bencher, src_len: usize) {
function bench_from_iter_0000 (line 668) | fn bench_from_iter_0000(b: &mut Bencher) {
function bench_from_iter_0010 (line 673) | fn bench_from_iter_0010(b: &mut Bencher) {
function bench_from_iter_0100 (line 678) | fn bench_from_iter_0100(b: &mut Bencher) {
function bench_from_iter_1000 (line 683) | fn bench_from_iter_1000(b: &mut Bencher) {
function do_bench_extend (line 687) | fn do_bench_extend(b: &mut Bencher, dst_len: usize, src_len: usize) {
function bench_extend_0000_0000 (line 701) | fn bench_extend_0000_0000(b: &mut Bencher) {
function bench_extend_0000_0010 (line 706) | fn bench_extend_0000_0010(b: &mut Bencher) {
function bench_extend_0000_0100 (line 711) | fn bench_extend_0000_0100(b: &mut Bencher) {
function bench_extend_0000_1000 (line 716) | fn bench_extend_0000_1000(b: &mut Bencher) {
function bench_extend_0010_0010 (line 721) | fn bench_extend_0010_0010(b: &mut Bencher) {
function bench_extend_0100_0100 (line 726) | fn bench_extend_0100_0100(b: &mut Bencher) {
function bench_extend_1000_1000 (line 731) | fn bench_extend_1000_1000(b: &mut Bencher) {
function do_bench_extend_from_slice (line 735) | fn do_bench_extend_from_slice(b: &mut Bencher, dst_len: usize, src_len: ...
function bench_extend_recycle (line 749) | fn bench_extend_recycle(b: &mut Bencher) {
function bench_extend_from_slice_0000_0000 (line 763) | fn bench_extend_from_slice_0000_0000(b: &mut Bencher) {
function bench_extend_from_slice_0000_0010 (line 768) | fn bench_extend_from_slice_0000_0010(b: &mut Bencher) {
function bench_extend_from_slice_0000_0100 (line 773) | fn bench_extend_from_slice_0000_0100(b: &mut Bencher) {
function bench_extend_from_slice_0000_1000 (line 778) | fn bench_extend_from_slice_0000_1000(b: &mut Bencher) {
function bench_extend_from_slice_0010_0010 (line 783) | fn bench_extend_from_slice_0010_0010(b: &mut Bencher) {
function bench_extend_from_slice_0100_0100 (line 788) | fn bench_extend_from_slice_0100_0100(b: &mut Bencher) {
function bench_extend_from_slice_1000_1000 (line 793) | fn bench_extend_from_slice_1000_1000(b: &mut Bencher) {
function do_bench_clone (line 797) | fn do_bench_clone(b: &mut Bencher, src_len: usize) {
function bench_clone_0000 (line 806) | fn bench_clone_0000(b: &mut Bencher) {
function bench_clone_0010 (line 811) | fn bench_clone_0010(b: &mut Bencher) {
function bench_clone_0100 (line 816) | fn bench_clone_0100(b: &mut Bencher) {
function bench_clone_1000 (line 821) | fn bench_clone_1000(b: &mut Bencher) {
function do_bench_clone_from (line 825) | fn do_bench_clone_from(b: &mut Bencher, times: usize, dst_len: usize, sr...
function bench_clone_from_01_0000_0000 (line 843) | fn bench_clone_from_01_0000_0000(b: &mut Bencher) {
function bench_clone_from_01_0000_0010 (line 848) | fn bench_clone_from_01_0000_0010(b: &mut Bencher) {
function bench_clone_from_01_0000_0100 (line 853) | fn bench_clone_from_01_0000_0100(b: &mut Bencher) {
function bench_clone_from_01_0000_1000 (line 858) | fn bench_clone_from_01_0000_1000(b: &mut Bencher) {
function bench_clone_from_01_0010_0010 (line 863) | fn bench_clone_from_01_0010_0010(b: &mut Bencher) {
function bench_clone_from_01_0100_0100 (line 868) | fn bench_clone_from_01_0100_0100(b: &mut Bencher) {
function bench_clone_from_01_1000_1000 (line 873) | fn bench_clone_from_01_1000_1000(b: &mut Bencher) {
function bench_clone_from_01_0010_0100 (line 878) | fn bench_clone_from_01_0010_0100(b: &mut Bencher) {
function bench_clone_from_01_0100_1000 (line 883) | fn bench_clone_from_01_0100_1000(b: &mut Bencher) {
function bench_clone_from_01_0010_0000 (line 888) | fn bench_clone_from_01_0010_0000(b: &mut Bencher) {
function bench_clone_from_01_0100_0010 (line 893) | fn bench_clone_from_01_0100_0010(b: &mut Bencher) {
function bench_clone_from_01_1000_0100 (line 898) | fn bench_clone_from_01_1000_0100(b: &mut Bencher) {
function bench_clone_from_10_0000_0000 (line 903) | fn bench_clone_from_10_0000_0000(b: &mut Bencher) {
function bench_clone_from_10_0000_0010 (line 908) | fn bench_clone_from_10_0000_0010(b: &mut Bencher) {
function bench_clone_from_10_0000_0100 (line 913) | fn bench_clone_from_10_0000_0100(b: &mut Bencher) {
function bench_clone_from_10_0000_1000 (line 918) | fn bench_clone_from_10_0000_1000(b: &mut Bencher) {
function bench_clone_from_10_0010_0010 (line 923) | fn bench_clone_from_10_0010_0010(b: &mut Bencher) {
function bench_clone_from_10_0100_0100 (line 928) | fn bench_clone_from_10_0100_0100(b: &mut Bencher) {
function bench_clone_from_10_1000_1000 (line 933) | fn bench_clone_from_10_1000_1000(b: &mut Bencher) {
function bench_clone_from_10_0010_0100 (line 938) | fn bench_clone_from_10_0010_0100(b: &mut Bencher) {
function bench_clone_from_10_0100_1000 (line 943) | fn bench_clone_from_10_0100_1000(b: &mut Bencher) {
function bench_clone_from_10_0010_0000 (line 948) | fn bench_clone_from_10_0010_0000(b: &mut Bencher) {
function bench_clone_from_10_0100_0010 (line 953) | fn bench_clone_from_10_0100_0010(b: &mut Bencher) {
function bench_clone_from_10_1000_0100 (line 958) | fn bench_clone_from_10_1000_0100(b: &mut Bencher) {
function bench_in_place_recycle (line 1001) | fn bench_in_place_recycle(b: &mut Bencher) {
function bench_in_place_zip_recycle (line 1018) | fn bench_in_place_zip_recycle(b: &mut Bencher) {
function bench_in_place_zip_iter_mut (line 1037) | fn bench_in_place_zip_iter_mut(b: &mut Bencher) {
function vec_cast (line 1052) | pub fn vec_cast<T, U>(input: Vec<T>) -> Vec<U> {
function bench_transmute (line 1057) | fn bench_transmute(b: &mut Bencher) {
type Droppable (line 1069) | struct Droppable(usize);
method drop (line 1072) | fn drop(&mut self) {
function bench_in_place_collect_droppable (line 1078) | fn bench_in_place_collect_droppable(b: &mut Bencher) {
constant LEN (line 1090) | const LEN: usize = 16384;
function bench_chain_collect (line 1093) | fn bench_chain_collect(b: &mut Bencher) {
function bench_chain_chain_collect (line 1099) | fn bench_chain_chain_collect(b: &mut Bencher) {
function bench_nest_chain_chain_collect (line 1111) | fn bench_nest_chain_chain_collect(b: &mut Bencher) {
function bench_range_map_collect (line 1119) | fn bench_range_map_collect(b: &mut Bencher) {
function bench_chain_extend_ref (line 1124) | fn bench_chain_extend_ref(b: &mut Bencher) {
function bench_chain_extend_value (line 1134) | fn bench_chain_extend_value(b: &mut Bencher) {
function bench_rev_1 (line 1144) | fn bench_rev_1(b: &mut Bencher) {
function bench_rev_2 (line 1154) | fn bench_rev_2(b: &mut Bencher) {
function bench_map_regular (line 1164) | fn bench_map_regular(b: &mut Bencher) {
function bench_map_fast (line 1174) | fn bench_map_fast(b: &mut Bencher) {
function random_sorted_fill (line 1188) | fn random_sorted_fill(mut seed: u32, buf: &mut [u32]) {
function bench_vec_dedup_old (line 1208) | fn bench_vec_dedup_old(b: &mut Bencher, sz: usize) {
function bench_vec_dedup_new (line 1227) | fn bench_vec_dedup_new(b: &mut Bencher, sz: usize) {
function bench_dedup_old_100 (line 1242) | fn bench_dedup_old_100(b: &mut Bencher) {
function bench_dedup_new_100 (line 1246) | fn bench_dedup_new_100(b: &mut Bencher) {
function bench_dedup_old_1000 (line 1251) | fn bench_dedup_old_1000(b: &mut Bencher) {
function bench_dedup_new_1000 (line 1255) | fn bench_dedup_new_1000(b: &mut Bencher) {
function bench_dedup_old_10000 (line 1260) | fn bench_dedup_old_10000(b: &mut Bencher) {
function bench_dedup_new_10000 (line 1264) | fn bench_dedup_new_10000(b: &mut Bencher) {
function bench_dedup_old_100000 (line 1269) | fn bench_dedup_old_100000(b: &mut Bencher) {
function bench_dedup_new_100000 (line 1273) | fn bench_dedup_new_100000(b: &mut Bencher) {
function bench_iteration (line 1414) | fn bench_iteration(b: &mut Bencher, size: i32) {
function iteration_20 (line 1430) | pub fn iteration_20(b: &mut Bencher) {
function iteration_1000 (line 1435) | pub fn iteration_1000(b: &mut Bencher) {
function iteration_100000 (line 1440) | pub fn iteration_100000(b: &mut Bencher) {
function bench_iteration_mut (line 1444) | fn bench_iteration_mut(b: &mut Bencher, size: i32) {
function iteration_mut_20 (line 1460) | pub fn iteration_mut_20(b: &mut Bencher) {
function iteration_mut_1000 (line 1465) | pub fn iteration_mut_1000(b: &mut Bencher) {
function iteration_mut_100000 (line 1470) | pub fn iteration_mut_100000(b: &mut Bencher) {
function bench_first_and_last (line 1474) | fn bench_first_and_last(b: &mut Bencher, size: i32) {
function first_and_last_0 (line 1485) | pub fn first_and_last_0(b: &mut Bencher) {
function first_and_last_100 (line 1490) | pub fn first_and_last_100(b: &mut Bencher) {
function first_and_last_10k (line 1495) | pub fn first_and_last_10k(b: &mut Bencher) {
constant BENCH_RANGE_SIZE (line 1499) | const BENCH_RANGE_SIZE: i32 = 145;
constant BENCH_RANGE_COUNT (line 1500) | const BENCH_RANGE_COUNT: i32 = BENCH_RANGE_SIZE * (BENCH_RANGE_SIZE - 1)...
function bench_range (line 1502) | fn bench_range<F, R>(b: &mut Bencher, f: F)
function range_included_excluded (line 1521) | pub fn range_included_excluded(b: &mut Bencher) {
function range_included_included (line 1526) | pub fn range_included_included(b: &mut Bencher) {
function range_included_unbounded (line 1531) | pub fn range_included_unbounded(b: &mut Bencher) {
function range_unbounded_unbounded (line 1536) | pub fn range_unbounded_unbounded(b: &mut Bencher) {
function bench_iter (line 1540) | fn bench_iter(b: &mut Bencher, repeats: i32, size: i32) {
function range_unbounded_vs_iter (line 1551) | pub fn range_unbounded_vs_iter(b: &mut Bencher) {
function iter_0 (line 1556) | pub fn iter_0(b: &mut Bencher) {
function iter_1 (line 1561) | pub fn iter_1(b: &mut Bencher) {
function iter_100 (line 1566) | pub fn iter_100(b: &mut Bencher) {
function iter_10k (line 1571) | pub fn iter_10k(b: &mut Bencher) {
function iter_1m (line 1576) | pub fn iter_1m(b: &mut Bencher) {
constant FAT (line 1580) | const FAT: usize = 256;
function slim_map (line 1584) | fn slim_map(n: usize) -> BTreeMap<usize, usize> {
function fat_val_map (line 1589) | fn fat_val_map(n: usize) -> BTreeMap<usize, [usize; FAT]> {
function clone_slim_100 (line 1594) | pub fn clone_slim_100(b: &mut Bencher) {
function clone_slim_100_and_clear (line 1600) | pub fn clone_slim_100_and_clear(b: &mut Bencher) {
function clone_slim_100_and_drain_all (line 1606) | pub fn clone_slim_100_and_drain_all(b: &mut Bencher) {
function clone_slim_100_and_drain_half (line 1612) | pub fn clone_slim_100_and_drain_half(b: &mut Bencher) {
function clone_slim_100_and_into_iter (line 1622) | pub fn clone_slim_100_and_into_iter(b: &mut Bencher) {
function clone_slim_100_and_pop_all (line 1628) | pub fn clone_slim_100_and_pop_all(b: &mut Bencher) {
function clone_slim_100_and_remove_all (line 1638) | pub fn clone_slim_100_and_remove_all(b: &mut Bencher) {
function clone_slim_100_and_remove_half (line 1651) | pub fn clone_slim_100_and_remove_half(b: &mut Bencher) {
function clone_slim_10k (line 1665) | pub fn clone_slim_10k(b: &mut Bencher) {
function clone_slim_10k_and_clear (line 1671) | pub fn clone_slim_10k_and_clear(b: &mut Bencher) {
function clone_slim_10k_and_drain_all (line 1677) | pub fn clone_slim_10k_and_drain_all(b: &mut Bencher) {
function clone_slim_10k_and_drain_half (line 1683) | pub fn clone_slim_10k_and_drain_half(b: &mut Bencher) {
function clone_slim_10k_and_into_iter (line 1693) | pub fn clone_slim_10k_and_into_iter(b: &mut Bencher) {
function clone_slim_10k_and_pop_all (line 1699) | pub fn clone_slim_10k_and_pop_all(b: &mut Bencher) {
function clone_slim_10k_and_remove_all (line 1709) | pub fn clone_slim_10k_and_remove_all(b: &mut Bencher) {
function clone_slim_10k_and_remove_half (line 1722) | pub fn clone_slim_10k_and_remove_half(b: &mut Bencher) {
function clone_fat_val_100 (line 1736) | pub fn clone_fat_val_100(b: &mut Bencher) {
function clone_fat_val_100_and_clear (line 1742) | pub fn clone_fat_val_100_and_clear(b: &mut Bencher) {
function clone_fat_val_100_and_drain_all (line 1748) | pub fn clone_fat_val_100_and_drain_all(b: &mut Bencher) {
function clone_fat_val_100_and_drain_half (line 1754) | pub fn clone_fat_val_100_and_drain_half(b: &mut Bencher) {
function clone_fat_val_100_and_into_iter (line 1764) | pub fn clone_fat_val_100_and_into_iter(b: &mut Bencher) {
function clone_fat_val_100_and_pop_all (line 1770) | pub fn clone_fat_val_100_and_pop_all(b: &mut Bencher) {
function clone_fat_val_100_and_remove_all (line 1780) | pub fn clone_fat_val_100_and_remove_all(b: &mut Bencher) {
function clone_fat_val_100_and_remove_half (line 1793) | pub fn clone_fat_val_100_and_remove_half(b: &mut Bencher) {
function random (line 1810) | fn random(n: usize) -> BTreeSet<usize> {
function neg (line 1820) | fn neg(n: usize) -> BTreeSet<i32> {
function pos (line 1826) | fn pos(n: usize) -> BTreeSet<i32> {
function stagger (line 1832) | fn stagger(n1: usize, factor: usize) -> [BTreeSet<u32>; 2] {
function slim_set (line 1857) | fn slim_set(n: usize) -> BTreeSet<usize> {
function clone_100 (line 1862) | pub fn clone_100(b: &mut Bencher) {
function clone_100_and_clear (line 1868) | pub fn clone_100_and_clear(b: &mut Bencher) {
function clone_100_and_drain_all (line 1874) | pub fn clone_100_and_drain_all(b: &mut Bencher) {
function clone_100_and_drain_half (line 1880) | pub fn clone_100_and_drain_half(b: &mut Bencher) {
function clone_100_and_into_iter (line 1890) | pub fn clone_100_and_into_iter(b: &mut Bencher) {
function clone_100_and_pop_all (line 1896) | pub fn clone_100_and_pop_all(b: &mut Bencher) {
function clone_100_and_remove_all (line 1906) | pub fn clone_100_and_remove_all(b: &mut Bencher) {
function clone_100_and_remove_half (line 1919) | pub fn clone_100_and_remove_half(b: &mut Bencher) {
function clone_10k (line 1933) | pub fn clone_10k(b: &mut Bencher) {
function clone_10k_and_clear (line 1939) | pub fn clone_10k_and_clear(b: &mut Bencher) {
function clone_10k_and_drain_all (line 1945) | pub fn clone_10k_and_drain_all(b: &mut Bencher) {
function clone_10k_and_drain_half (line 1951) | pub fn clone_10k_and_drain_half(b: &mut Bencher) {
function clone_10k_and_into_iter (line 1961) | pub fn clone_10k_and_into_iter(b: &mut Bencher) {
function clone_10k_and_pop_all (line 1967) | pub fn clone_10k_and_pop_all(b: &mut Bencher) {
function clone_10k_and_remove_all (line 1977) | pub fn clone_10k_and_remove_all(b: &mut Bencher) {
function clone_10k_and_remove_half (line 1990) | pub fn clone_10k_and_remove_half(b: &mut Bencher) {
function iterator (line 2039) | fn iterator(b: &mut Bencher) {
function mut_iterator (line 2057) | fn mut_iterator(b: &mut Bencher) {
function concat (line 2070) | fn concat(b: &mut Bencher) {
function join (line 2078) | fn join(b: &mut Bencher) {
function push (line 2084) | fn push(b: &mut Bencher) {
function starts_with_same_vector (line 2093) | fn starts_with_same_vector(b: &mut Bencher) {
function starts_with_single_element (line 2099) | fn starts_with_single_element(b: &mut Bencher) {
function starts_with_diff_one_element_at_end (line 2105) | fn starts_with_diff_one_element_at_end(b: &mut Bencher) {
function ends_with_same_vector (line 2113) | fn ends_with_same_vector(b: &mut Bencher) {
function ends_with_single_element (line 2119) | fn ends_with_single_element(b: &mut Bencher) {
function ends_with_diff_one_element_at_beginning (line 2125) | fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) {
function contains_last_element (line 2133) | fn contains_last_element(b: &mut Bencher) {
function zero_1kb_from_elem (line 2139) | fn zero_1kb_from_elem(b: &mut Bencher) {
function zero_1kb_set_memory (line 2144) | fn zero_1kb_set_memory(b: &mut Bencher) {
function zero_1kb_loop_set (line 2157) | fn zero_1kb_loop_set(b: &mut Bencher) {
function zero_1kb_mut_iter (line 2170) | fn zero_1kb_mut_iter(b: &mut Bencher) {
function random_inserts (line 2184) | fn random_inserts(b: &mut Bencher) {
function random_removes (line 2196) | fn random_removes(b: &mut Bencher) {
function gen_ascending (line 2207) | fn gen_ascending(len: usize) -> Vec<u64> {
function gen_descending (line 2211) | fn gen_descending(len: usize) -> Vec<u64> {
constant SEED (line 2215) | const SEED: [u8; 16] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14...
function gen_random (line 2217) | fn gen_random(len: usize) -> Vec<u64> {
function gen_random_bytes (line 2222) | fn gen_random_bytes(len: usize) -> Vec<u8> {
function gen_mostly_ascending (line 2227) | fn gen_mostly_ascending(len: usize) -> Vec<u64> {
function gen_mostly_descending (line 2238) | fn gen_mostly_descending(len: usize) -> Vec<u64> {
function gen_strings (line 2249) | fn gen_strings(len: usize) -> Vec<String> {
function gen_big_random (line 2259) | fn gen_big_random(len: usize) -> Vec<[u64; 16]> {
type F64x4 (line 2372) | struct F64x4(f64, f64, f64, f64);
function bench_new (line 2417) | fn bench_new(b: &mut Bencher) {
function bench_grow_1025 (line 2425) | fn bench_grow_1025(b: &mut Bencher) {
function bench_iter_1000 (line 2436) | fn bench_iter_1000(b: &mut Bencher) {
function bench_mut_iter_1000 (line 2449) | fn bench_mut_iter_1000(b: &mut Bencher) {
function bench_try_fold (line 2462) | fn bench_try_fold(b: &mut Bencher) {
function bench_find_smallest_1000 (line 2473) | fn bench_find_smallest_1000(b: &mut Bencher) {
function bench_peek_mut_deref_mut (line 2496) | fn bench_peek_mut_deref_mut(b: &mut Bencher) {
function bench_from_vec (line 2515) | fn bench_from_vec(b: &mut Bencher) {
function bench_into_sorted_vec (line 2524) | fn bench_into_sorted_vec(b: &mut Bencher) {
function bench_push (line 2531) | fn bench_push(b: &mut Bencher) {
function bench_pop (line 2547) | fn bench_pop(b: &mut Bencher) {
constant VECDEQUE_LEN (line 2560) | const VECDEQUE_LEN: i32 = 100000;
constant WARMUP_N (line 2561) | const WARMUP_N: usize = 100;
constant BENCH_N (line 2562) | const BENCH_N: usize = 1000;
function main (line 2564) | fn main() {
function test_basic (line 2596) | fn test_basic() {
function generate_test (line 2635) | fn generate_test() -> LinkedList<i32> {
function list_from (line 2639) | fn list_from<T: Clone>(v: &[T]) -> LinkedList<T> {
function test_split_off (line 2644) | fn test_split_off() {
function test_iterator (line 2700) | fn test_iterator() {
function test_iterator_clone (line 2716) | fn test_iterator_clone() {
function test_iterator_double_end (line 2730) | fn test_iterator_double_end() {
function test_rev_iter (line 2748) | fn test_rev_iter() {
function test_mut_iter (line 2764) | fn test_mut_iter() {
function test_iterator_mut_double_end (line 2785) | fn test_iterator_mut_double_end() {
function test_mut_rev_iter (line 2803) | fn test_mut_rev_iter() {
function test_eq (line 2817) | fn test_eq() {
function test_hash (line 2832) | fn test_hash() {
function test_ord (line 2852) | fn test_ord() {
function test_ord_nan (line 2862) | fn test_ord_nan() {
function test_show (line 2894) | fn test_show() {
function test_extend_ref (line 2903) | fn test_extend_ref() {
function test_extend (line 2922) | fn test_extend() {
function test_contains (line 2938) | fn test_contains() {
function drain_filter_empty (line 2951) | fn drain_filter_empty() {
function drain_filter_zst (line 2968) | fn drain_filter_zst() {
function drain_filter_false (line 2991) | fn drain_filter_false() {
function drain_filter_true (line 3014) | fn drain_filter_true() {
function drain_filter_complex (line 3038) | fn drain_filter_complex() {
function drain_filter_drop_panic_leak (line 3126) | fn drain_filter_drop_panic_leak() {
function drain_filter_pred_panic_leak (line 3160) | fn drain_filter_pred_panic_leak() {
function test_drop (line 3194) | fn test_drop() {
function test_drop_with_pop (line 3216) | fn test_drop_with_pop() {
function test_drop_clear (line 3242) | fn test_drop_clear() {
function test_drop_panic (line 3266) | fn test_drop_panic() {
function uninhabited (line 3305) | fn uninhabited() {
function slice (line 3317) | fn slice() {
function trait_object (line 3330) | fn trait_object() {
function float_nan_ne (line 3348) | fn float_nan_ne() {
function partial_eq (line 3355) | fn partial_eq() {
function eq (line 3371) | fn eq() {
type Rc (line 3389) | type Rc<T> = Arc<T>;
constant SHARED_ITER_MAX (line 3391) | const SHARED_ITER_MAX: u16 = 100;
function assert_trusted_len (line 3393) | fn assert_trusted_len<I: TrustedLen>(_: &I) {}
function shared_from_iter_normal (line 3396) | fn shared_from_iter_normal() {
function shared_from_iter_trustedlen_normal (line 3418) | fn shared_from_iter_trustedlen_normal() {
function shared_from_iter_trustedlen_panic (line 3456) | fn shared_from_iter_trustedlen_panic() {
function shared_from_iter_trustedlen_no_fuse (line 3470) | fn shared_from_iter_trustedlen_no_fuse() {
function test_le (line 3499) | fn test_le() {
function test_find (line 3507) | fn test_find() {
function test_rfind (line 3517) | fn test_rfind() {
function test_collect (line 3527) | fn test_collect() {
function test_into_bytes (line 3537) | fn test_into_bytes() {
function test_find_str (line 3544) | fn test_find_str() {
function s (line 3591) | fn s(x: &str) -> String {
function test_concat_for_different_types (line 3603) | fn test_concat_for_different_types() {
function test_concat_for_different_lengths (line 3609) | fn test_concat_for_different_lengths() {
function test_join_for_different_types (line 3625) | fn test_join_for_different_types() {
function test_join_for_different_lengths (line 3635) | fn test_join_for_different_lengths() {
function test_join_for_different_lengths_with_long_separator (line 3646) | fn test_join_for_different_lengths_with_long_separator() {
function test_join_isue_80335 (line 3657) | fn test_join_isue_80335() {
function test_unsafe_slice (line 3688) | fn test_unsafe_slice() {
function test_starts_with (line 3715) | fn test_starts_with() {
function test_ends_with (line 3726) | fn test_ends_with() {
function test_is_empty (line 3737) | fn test_is_empty() {
function test_replacen (line 3743) | fn test_replacen() {
function test_replace (line 3757) | fn test_replace() {
function test_replace_2a (line 3768) | fn test_replace_2a() {
function test_replace_2b (line 3778) | fn test_replace_2b() {
function test_replace_2c (line 3788) | fn test_replace_2c() {
function test_replace_2d (line 3798) | fn test_replace_2d() {
function test_replace_pattern (line 3807) | fn test_replace_pattern() {
function assert_range_eq_can_fail_by_panic (line 3870) | fn assert_range_eq_can_fail_by_panic() {
function assert_range_eq_can_fail_by_inequality (line 3879) | fn assert_range_eq_can_fail_by_inequality() {
function simple_ascii (line 3944) | fn simple_ascii() {
function simple_unicode (line 3959) | fn simple_unicode() {
function simple_big (line 4004) | fn simple_big() {
function test_slice_fail (line 4029) | fn test_slice_fail() {
constant DATA (line 4134) | const DATA: &str = "abcαβγ";
constant BAD_START (line 4136) | const BAD_START: usize = 4;
constant GOOD_START (line 4137) | const GOOD_START: usize = 3;
constant BAD_END (line 4138) | const BAD_END: usize = 6;
constant GOOD_END (line 4139) | const GOOD_END: usize = 7;
constant BAD_END_INCL (line 4140) | const BAD_END_INCL: usize = BAD_END - 1;
constant GOOD_END_INCL (line 4141) | const GOOD_END_INCL: usize = GOOD_END - 1;
constant LOREM_PARAGRAPH (line 4198) | const LOREM_PARAGRAPH: &str = "\
function test_slice_fail_truncated_1 (line 4209) | fn test_slice_fail_truncated_1() {
function test_slice_fail_truncated_2 (line 4215) | fn test_slice_fail_truncated_2() {
function test_str_slice_rangetoinclusive_ok (line 4221) | fn test_str_slice_rangetoinclusive_ok() {
function test_str_slice_rangetoinclusive_notok (line 4229) | fn test_str_slice_rangetoinclusive_notok() {
function test_str_slicemut_rangetoinclusive_ok (line 4235) | fn test_str_slicemut_rangetoinclusive_ok() {
function test_str_slicemut_rangetoinclusive_notok (line 4244) | fn test_str_slicemut_rangetoinclusive_notok() {
function test_is_char_boundary (line 4251) | fn test_is_char_boundary() {
function test_trim_start_matches (line 4271) | fn test_trim_start_matches() {
function test_trim_end_matches (line 4286) | fn test_trim_end_matches() {
function test_trim_matches (line 4301) | fn test_trim_matches() {
function test_trim_start (line 4316) | fn test_trim_start() {
function test_trim_end (line 4326) | fn test_trim_end() {
function test_trim (line 4336) | fn test_trim() {
function test_is_whitespace (line 4346) | fn test_is_whitespace() {
function test_is_utf8 (line 4355) | fn test_is_utf8() {
function from_utf8_mostly_ascii (line 4380) | fn from_utf8_mostly_ascii() {
function from_utf8_error (line 4392) | fn from_utf8_error() {
function test_as_bytes (line 4422) | fn test_as_bytes() {
function test_as_bytes_fail (line 4436) | fn test_as_bytes_fail() {
function test_as_ptr (line 4445) | fn test_as_ptr() {
function vec_str_conversions (line 4457) | fn vec_str_conversions() {
function test_contains (line 4475) | fn test_contains() {
function test_contains_char (line 4492) | fn test_contains_char() {
function test_split_at (line 4500) | fn test_split_at() {
function test_split_at_mut (line 4513) | fn test_split_at_mut() {
function test_split_at_boundscheck (line 4525) | fn test_split_at_boundscheck() {
function test_escape_unicode (line 4531) | fn test_escape_unicode() {
function test_escape_debug (line 4544) | fn test_escape_debug() {
function test_escape_default (line 4568) | fn test_escape_default() {
function test_total_ord (line 4582) | fn test_total_ord() {
function test_iterator (line 4591) | fn test_iterator() {
function test_rev_iterator (line 4607) | fn test_rev_iterator() {
function test_chars_decoding (line 4623) | fn test_chars_decoding() {
function test_chars_rev_decoding (line 4635) | fn test_chars_rev_decoding() {
function test_iterator_clone (line 4646) | fn test_iterator_clone() {
function test_iterator_last (line 4654) | fn test_iterator_last() {
function test_chars_debug (line 4662) | fn test_chars_debug() {
function test_bytesator (line 4672) | fn test_bytesator() {
function test_bytes_revator (line 4687) | fn test_bytes_revator() {
function test_bytesator_nth (line 4702) | fn test_bytesator_nth() {
function test_bytesator_count (line 4716) | fn test_bytesator_count() {
function test_bytesator_last (line 4724) | fn test_bytesator_last() {
function test_char_indicesator (line 4732) | fn test_char_indicesator() {
function test_char_indices_revator (line 4749) | fn test_char_indices_revator() {
function test_char_indices_last (line 4766) | fn test_char_indices_last() {
function test_splitn_char_iterator (line 4774) | fn test_splitn_char_iterator() {
function test_split_char_iterator_no_trailing (line 4792) | fn test_split_char_iterator_no_trailing() {
function test_split_char_iterator_inclusive (line 4803) | fn test_split_char_iterator_inclusive() {
function test_split_char_iterator_inclusive_rev (line 4822) | fn test_split_char_iterator_inclusive_rev() {
function test_rsplit (line 4846) | fn test_rsplit() {
function test_rsplitn (line 4860) | fn test_rsplitn() {
function test_split_once (line 4874) | fn test_split_once() {
function test_rsplit_once (line 4886) | fn test_rsplit_once() {
function test_split_whitespace (line 4898) | fn test_split_whitespace() {
function test_lines (line 4905) | fn test_lines() {
function test_splitator (line 4916) | fn test_splitator() {
function test_str_default (line 4938) | fn test_str_default() {
function test_str_container (line 4952) | fn test_str_container() {
function test_str_from_utf8 (line 4964) | fn test_str_from_utf8() {
function test_pattern_deref_forward (line 4976) | fn test_pattern_deref_forward() {
function test_empty_match_indices (line 4984) | fn test_empty_match_indices() {
function test_bool_from_str (line 4991) | fn test_bool_from_str() {
function check_contains_all_substrings (line 4997) | fn check_contains_all_substrings(s: &str) {
function strslice_issue_16589 (line 5008) | fn strslice_issue_16589() {
function strslice_issue_16878 (line 5017) | fn strslice_issue_16878() {
function test_strslice_contains (line 5024) | fn test_strslice_contains() {
function test_rsplitn_char_iterator (line 5030) | fn test_rsplitn_char_iterator() {
function test_split_char_iterator (line 5052) | fn test_split_char_iterator() {
function test_rev_split_char_iterator_no_trailing (line 5086) | fn test_rev_split_char_iterator_no_trailing() {
function test_utf16_code_units (line 5099) | fn test_utf16_code_units() {
function starts_with_in_unicode (line 5104) | fn starts_with_in_unicode() {
function starts_short_long (line 5109) | fn starts_short_long() {
function contains_weird_cases (line 5128) | fn contains_weird_cases() {
function trim_ws (line 5135) | fn trim_ws() {
function to_lowercase (line 5149) | fn to_lowercase() {
function to_uppercase (line 5182) | fn to_uppercase() {
function test_into_string (line 5188) | fn test_into_string() {
function test_box_slice_clone (line 5196) | fn test_box_slice_clone() {
function test_cow_from (line 5204) | fn test_cow_from() {
function test_repeat (line 5214) | fn test_repeat() {
function cmp_search_to_vec (line 5242) | fn cmp_search_to_vec<'a>(
function different_str_pattern_forwarding_lifetimes (line 5462) | fn different_str_pattern_forwarding_lifetimes() {
function test_str_multiline (line 5478) | fn test_str_multiline() {
function test_str_escapes (line 5492) | fn test_str_escapes() {
function const_str_ptr (line 5499) | fn const_str_ptr() {
function utf8 (line 5519) | fn utf8() {
function utf8_chars (line 5569) | fn utf8_chars() {
function test_hash (line 5599) | fn test_hash() {
type IntoCow (line 5624) | pub trait IntoCow<'a, B: ?Sized>
method into_cow (line 5628) | fn into_cow(self) -> Cow<'a, B>;
function into_cow (line 5638) | fn into_cow(self) -> Cow<'a, str> {
function test_from_str (line 5644) | fn test_from_str() {
function test_from_cow_str (line 5650) | fn test_from_cow_str() {
function test_unsized_to_string (line 5656) | fn test_unsized_to_string() {
function test_from_utf8 (line 5662) | fn test_from_utf8() {
function test_from_utf8_lossy (line 5679) | fn test_from_utf8_lossy() {
function test_from_utf16 (line 5733) | fn test_from_utf16() {
function test_utf16_invalid (line 5788) | fn test_utf16_invalid() {
function test_from_utf16_lossy (line 5803) | fn test_from_utf16_lossy() {
function test_push_bytes (line 5821) | fn test_push_bytes() {
function test_push_str (line 5831) | fn test_push_str() {
function test_add_assign (line 5842) | fn test_add_assign() {
function test_push (line 5853) | fn test_push() {
function test_pop (line 5864) | fn test_pop() {
function test_split_off_empty (line 5875) | fn test_split_off_empty() {
function test_split_off_past_end (line 5884) | fn test_split_off_past_end() {
function test_split_off_mid_char (line 5892) | fn test_split_off_mid_char() {
function test_split_off_ascii (line 5898) | fn test_split_off_ascii() {
function test_split_off_unicode (line 5908) | fn test_split_off_unicode() {
function test_str_truncate (line 5918) | fn test_str_truncate() {
function test_str_truncate_invalid_len (line 5936) | fn test_str_truncate_invalid_len() {
function test_str_truncate_split_codepoint (line 5944) | fn test_str_truncate_split_codepoint() {
function test_str_clear (line 5950) | fn test_str_clear() {
function test_str_add (line 5958) | fn test_str_add() {
function remove (line 5967) | fn remove() {
function remove_bad (line 5978) | fn remove_bad() {
function test_remove_matches (line 5983) | fn test_remove_matches() {
function test_retain (line 6010) | fn test_retain() {
function insert (line 6044) | fn insert() {
function insert_bad1 (line 6054) | fn insert_bad1() {
function insert_bad2 (line 6059) | fn insert_bad2() {
function test_slicing (line 6064) | fn test_slicing() {
function test_simple_types (line 6073) | fn test_simple_types() {
function test_vectors (line 6084) | fn test_vectors() {
function test_from_iterator (line 6093) | fn test_from_iterator() {
function test_drain (line 6114) | fn test_drain() {
function test_drain_start_overflow (line 6132) | fn test_drain_start_overflow() {
function test_drain_end_overflow (line 6139) | fn test_drain_end_overflow() {
function test_replace_range (line 6145) | fn test_replace_range() {
function test_replace_range_char_boundary (line 6153) | fn test_replace_range_char_boundary() {
function test_replace_range_inclusive_range (line 6159) | fn test_replace_range_inclusive_range() {
function test_replace_range_out_of_bounds (line 6169) | fn test_replace_range_out_of_bounds() {
function test_replace_range_inclusive_out_of_bounds (line 6176) | fn test_replace_range_inclusive_out_of_bounds() {
function test_replace_range_start_overflow (line 6183) | fn test_replace_range_start_overflow() {
function test_replace_range_end_overflow (line 6190) | fn test_replace_range_end_overflow() {
function test_replace_range_empty (line 6196) | fn test_replace_range_empty() {
function test_replace_range_unbounded (line 6203) | fn test_replace_range_unbounded() {
function test_replace_range_evil_start_bound (line 6210) | fn test_replace_range_evil_start_bound() {
function test_replace_range_evil_end_bound (line 6233) | fn test_replace_range_evil_end_bound() {
function test_extend_ref (line 6256) | fn test_extend_ref() {
function test_into_boxed_str (line 6264) | fn test_into_boxed_str() {
function test_reserve_exact (line 6271) | fn test_reserve_exact() {
function test_try_reserve (line 6297) | fn test_try_reserve() {
function test_try_reserve_exact (line 6387) | fn test_try_reserve_exact() {
function test_from_char (line 6457) | fn test_from_char() {
function test_str_concat (line 6464) | fn test_str_concat() {
function test_from_cow_slice (line 6489) | fn test_from_cow_slice() {
function test_from_cow_str (line 6495) | fn test_from_cow_str() {
function test_from_cow_c_str (line 6501) | fn test_from_cow_c_str() {
function test_from_cow_os_str (line 6507) | fn test_from_cow_os_str() {
function test_from_cow_path (line 6513) | fn test_from_cow_path() {
function cow_const (line 6519) | fn cow_const() {
type DropCounter (line 6542) | struct DropCounter<'a> {
method drop (line 6547) | fn drop(&mut self) {
function test_small_vec_struct (line 6553) | fn test_small_vec_struct() {
function test_double_drop (line 6558) | fn test_double_drop() {
function test_reserve (line 6583) | fn test_reserve() {
function test_zst_capacity (line 6605) | fn test_zst_capacity() {
function test_indexing (line 6610) | fn test_indexing() {
function test_debug_fmt (line 6623) | fn test_debug_fmt() {
function test_push (line 6635) | fn test_push() {
function test_extend (line 6646) | fn test_extend() {
function test_extend_from_slice (line 6691) | fn test_extend_from_slice() {
function test_extend_ref (line 6703) | fn test_extend_ref() {
function test_slice_from_ref (line 6718) | fn test_slice_from_ref() {
function test_slice_from_mut (line 6726) | fn test_slice_from_mut() {
function test_slice_to_mut (line 6740) | fn test_slice_to_mut() {
function test_split_at_mut (line 6754) | fn test_split_at_mut() {
function test_clone (line 6779) | fn test_clone() {
function test_clone_from (line 6792) | fn test_clone_from() {
function test_retain (line 6814) | fn test_retain() {
function test_retain_pred_panic_with_hole (line 6821) | fn test_retain_pred_panic_with_hole() {
function test_retain_pred_panic_no_hole (line 6838) | fn test_retain_pred_panic_no_hole() {
function test_retain_drop_panic (line 6853) | fn test_retain_drop_panic() {
function test_dedup (line 6882) | fn test_dedup() {
function test_dedup_by_key (line 6899) | fn test_dedup_by_key() {
function test_dedup_by (line 6916) | fn test_dedup_by() {
function test_dedup_unique (line 6934) | fn test_dedup_unique() {
function zero_sized_values (line 6946) | fn zero_sized_values() {
function test_partition (line 6979) | fn test_partition() {
function test_zip_unzip (line 6987) | fn test_zip_unzip() {
function test_cmp (line 6998) | fn test_cmp() {
function test_vec_truncate_drop (line 7021) | fn test_vec_truncate_drop() {
function test_vec_truncate_fail (line 7042) | fn test_vec_truncate_fail() {
function test_index (line 7058) | fn test_index() {
function test_index_out_of_bounds (line 7065) | fn test_index_out_of_bounds() {
function test_slice_out_of_bounds_1 (line 7072) | fn test_slice_out_of_bounds_1() {
function test_slice_out_of_bounds_2 (line 7079) | fn test_slice_out_of_bounds_2() {
function test_slice_out_of_bounds_3 (line 7086) | fn test_slice_out_of_bounds_3() {
function test_slice_out_of_bounds_4 (line 7093) | fn test_slice_out_of_bounds_4() {
function test_slice_out_of_bounds_5 (line 7100) | fn test_slice_out_of_bounds_5() {
function test_swap_remove_empty (line 7107) | fn test_swap_remove_empty() {
function test_move_items (line 7113) | fn test_move_items() {
function test_move_items_reverse (line 7123) | fn test_move_items_reverse() {
function test_move_items_zero_sized (line 7133) | fn test_move_items_zero_sized() {
function test_drain_empty_vec (line 7143) | fn test_drain_empty_vec() {
function test_drain_items (line 7154) | fn test_drain_items() {
function test_drain_items_reverse (line 7165) | fn test_drain_items_reverse() {
function test_drain_items_zero_sized (line 7176) | fn test_drain_items_zero_sized() {
function test_drain_out_of_bounds (line 7188) | fn test_drain_out_of_bounds() {
function test_drain_range (line 7194) | fn test_drain_range() {
function test_drain_inclusive_range (line 7213) | fn test_drain_inclusive_range() {
function test_drain_max_vec_size (line 7236) | fn test_drain_max_vec_size() {
function test_drain_index_overflow (line 7254) | fn test_drain_index_overflow() {
function test_drain_inclusive_out_of_bounds (line 7264) | fn test_drain_inclusive_out_of_bounds() {
function test_drain_start_overflow (line 7271) | fn test_drain_start_overflow() {
function test_drain_end_overflow (line 7278) | fn test_drain_end_overflow() {
function test_drain_leak (line 7284) | fn test_drain_leak() {
function test_splice (line 7322) | fn test_splice() {
function test_splice_inclusive_range (line 7332) | fn test_splice_inclusive_range() {
function test_splice_out_of_bounds (line 7345) | fn test_splice_out_of_bounds() {
function test_splice_inclusive_out_of_bounds (line 7353) | fn test_splice_inclusive_out_of_bounds() {
function test_splice_items_zero_sized (line 7360) | fn test_splice_items_zero_sized() {
function test_splice_unbounded (line 7369) | fn test_splice_unbounded() {
function test_splice_forget (line 7377) | fn test_splice_forget() {
function test_into_boxed_slice (line 7385) | fn test_into_boxed_slice() {
function test_append (line 7392) | fn test_append() {
function test_split_off (line 7401) | fn test_split_off() {
function test_split_off_take_all (line 7411) | fn test_split_off_take_all() {
function test_into_iter_as_slice (line 7423) | fn test_into_iter_as_slice() {
function test_into_iter_as_mut_slice (line 7435) | fn test_into_iter_as_mut_slice() {
function test_into_iter_debug (line 7446) | fn test_into_iter_debug() {
function test_into_iter_count (line 7454) | fn test_into_iter_count() {
function test_into_iter_clone (line 7459) | fn test_into_iter_clone() {
function test_into_iter_leak (line 7477) | fn test_into_iter_leak() {
function test_from_iter_specialization (line 7502) | fn test_from_iter_specialization() {
function test_from_iter_partially_drained_in_place_specialization (line 7511) | fn test_from_iter_partially_drained_in_place_specialization() {
function test_from_iter_specialization_with_iterator_adapters (line 7523) | fn test_from_iter_specialization_with_iterator_adapters() {
function test_from_iter_specialization_head_tail_drop (line 7544) | fn test_from_iter_specialization_head_tail_drop() {
function test_from_iter_specialization_panic_during_iteration_drops (line 7559) | fn test_from_iter_specialization_panic_during_iteration_drops() {
function test_from_iter_specialization_panic_during_drop_leaks (line 7583) | fn test_from_iter_specialization_panic_during_drop_leaks() {
function test_cow_from (line 7628) | fn test_cow_from() {
function test_from_cow (line 7638) | fn test_from_cow() {
function assert_covariance (line 7646) | fn assert_covariance() {
function from_into_inner (line 7656) | fn from_into_inner() {
function overaligned_allocations (line 7672) | fn overaligned_allocations() {
function drain_filter_empty (line 7687) | fn drain_filter_empty() {
function drain_filter_zst (line 7703) | fn drain_filter_zst() {
function drain_filter_false (line 7725) | fn drain_filter_false() {
function drain_filter_true (line 7747) | fn drain_filter_true() {
function drain_filter_complex (line 7770) | fn drain_filter_complex() {
function drain_filter_consumed_panic (line 7841) | fn drain_filter_consumed_panic() {
function drain_filter_unconsumed_panic (line 7893) | fn drain_filter_unconsumed_panic() {
function drain_filter_unconsumed (line 7942) | fn drain_filter_unconsumed() {
function test_reserve_exact (line 7950) | fn test_reserve_exact() {
function test_try_reserve (line 7976) | fn test_try_reserve() {
function test_try_reserve_exact (line 8094) | fn test_try_reserve_exact() {
function test_stable_pointers (line 8190) | fn test_stable_pointers() {
function vec_macro_repeating_null_raw_fat_pointer (line 8292) | fn vec_macro_repeating_null_raw_fat_pointer() {
function test_push_growth_strategy (line 8322) | fn test_push_growth_strategy() {
function partialeq_vec_and_prim (line 8447) | fn partialeq_vec_and_prim() {
function partialeq_vec_full (line 8466) | fn partialeq_vec_full() {
function test_vec_cycle (line 8489) | fn test_vec_cycle() {
function test_vec_cycle_wrapped (line 8527) | fn test_vec_cycle_wrapped() {
function test_zero_sized_vec_push (line 8568) | fn test_zero_sized_vec_push() {
function test_vec_macro_repeat (line 8585) | fn test_vec_macro_repeat() {
function test_vec_swap (line 8598) | fn test_vec_swap() {
function test_extend_from_within_spec (line 8610) | fn test_extend_from_within_spec() {
function test_extend_from_within_clone (line 8624) | fn test_extend_from_within_clone() {
function test_extend_from_within_complete_rande (line 8632) | fn test_extend_from_within_complete_rande() {
function test_extend_from_within_empty_rande (line 8640) | fn test_extend_from_within_empty_rande() {
function test_extend_from_within_out_of_rande (line 8649) | fn test_extend_from_within_out_of_rande() {
function test_extend_from_within_zst (line 8655) | fn test_extend_from_within_zst() {
function test_extend_from_within_empty_vec (line 8663) | fn test_extend_from_within_empty_vec() {
function test_extend_from_within (line 8671) | fn test_extend_from_within() {
function test_vec_dedup_by (line 8680) | fn test_vec_dedup_by() {
function test_vec_dedup_empty (line 8689) | fn test_vec_dedup_empty() {
function test_vec_dedup_one (line 8698) | fn test_vec_dedup_one() {
function test_vec_dedup_multiple_ident (line 8707) | fn test_vec_dedup_multiple_ident() {
function test_vec_dedup_partialeq (line 8716) | fn test_vec_dedup_partialeq() {
function test_vec_dedup (line 8733) | fn test_vec_dedup() {
function test_vec_dedup_panicking (line 8753) | fn test_vec_dedup_panicking() {
function test_extend_from_within_panicing_clone (line 8807) | fn test_extend_from_within_panicing_clone() {
function hash (line 8889) | fn hash<T: Hash>(t: &T) -> u64 {
function test_boxed_hasher (line 8899) | fn test_boxed_hasher() {
function check_cow_add_cow (line 8914) | fn check_cow_add_cow() {
function check_cow_add_str (line 8944) | fn check_cow_add_str() {
function check_cow_add_assign_cow (line 8967) | fn check_cow_add_assign_cow() {
function check_cow_add_assign_str (line 9009) | fn check_cow_add_assign_str() {
function check_cow_clone_from (line 9043) | fn check_cow_clone_from() {
function uninhabited (line 9062) | fn uninhabited() {
function slice (line 9074) | fn slice() {
function trait_object (line 9087) | fn trait_object() {
function float_nan_ne (line 9105) | fn float_nan_ne() {
function partial_eq (line 9112) | fn partial_eq() {
function eq (line 9128) | fn eq() {
constant SHARED_ITER_MAX (line 9144) | const SHARED_ITER_MAX: u16 = 100;
function assert_trusted_len (line 9146) | fn assert_trusted_len<I: TrustedLen>(_: &I) {}
function shared_from_iter_normal (line 9149) | fn shared_from_iter_normal() {
function shared_from_iter_trustedlen_normal (line 9171) | fn shared_from_iter_trustedlen_normal() {
function shared_from_iter_trustedlen_panic (line 9209) | fn shared_from_iter_trustedlen_panic() {
function shared_from_iter_trustedlen_no_fuse (line 9223) | fn shared_from_iter_trustedlen_no_fuse() {
function square (line 9259) | fn square(n: usize) -> usize {
function is_odd (line 9263) | fn is_odd(n: &usize) -> bool {
function test_from_fn (line 9268) | fn test_from_fn() {
function test_from_elem (line 9293) | fn test_from_elem() {
function test_is_empty (line 9317) | fn test_is_empty() {
function test_len_divzero (line 9324) | fn test_len_divzero() {
function test_get (line 9336) | fn test_get() {
function test_first (line 9346) | fn test_first() {
function test_first_mut (line 9356) | fn test_first_mut() {
function test_split_first (line 9366) | fn test_split_first() {
function test_split_first_mut (line 9377) | fn test_split_first_mut() {
function test_split_last (line 9388) | fn test_split_last() {
function test_split_last_mut (line 9399) | fn test_split_last_mut() {
function test_last (line 9411) | fn test_last() {
function test_last_mut (line 9421) | fn test_last_mut() {
function test_slice (line 9431) | fn test_slice() {
function test_slice_from (line 9462) | fn test_slice_from() {
function test_slice_to (line 9472) | fn test_slice_to() {
function test_pop (line 9482) | fn test_pop() {
function test_swap_remove (line 9494) | fn test_swap_remove() {
function test_swap_remove_fail (line 9506) | fn test_swap_remove_fail() {
function test_swap_remove_noncopyable (line 9513) | fn test_swap_remove_noncopyable() {
function test_push (line 9528) | fn test_push() {
function test_truncate (line 9543) | fn test_truncate() {
function test_clear (line 9553) | fn test_clear() {
function test_retain (line 9561) | fn test_retain() {
function test_binary_search (line 9568) | fn test_binary_search() {
function test_reverse (line 9613) | fn test_reverse() {
function test_sort (line 9638) | fn test_sort() {
function test_sort_stability (line 9712) | fn test_sort_stability() {
function test_rotate_left (line 9754) | fn test_rotate_left() {
function test_rotate_right (line 9789) | fn test_rotate_right() {
function test_concat (line 9824) | fn test_concat() {
function test_join (line 9838) | fn test_join() {
function test_join_nocopy (line 9851) | fn test_join_nocopy() {
function test_insert (line 9860) | fn test_insert() {
function test_insert_oob (line 9880) | fn test_insert_oob() {
function test_remove (line 9886) | fn test_remove() {
function test_remove_fail (line 9904) | fn test_remove_fail() {
function test_capacity (line 9911) | fn test_capacity() {
function test_slice_2 (line 9918) | fn test_slice_2() {
function test_total_ord_u8 (line 9942) | fn test_total_ord_u8() {
function test_total_ord_i32 (line 9956) | fn test_total_ord_i32() {
function test_iterator (line 9970) | fn test_iterator() {
function test_iter_size_hints (line 9988) | fn test_iter_size_hints() {
function test_iter_as_slice (line 9995) | fn test_iter_as_slice() {
function test_iter_as_ref (line 10004) | fn test_iter_as_ref() {
function test_iter_clone (line 10013) | fn test_iter_clone() {
function test_iter_is_empty (line 10024) | fn test_iter_is_empty() {
function test_mut_iterator (line 10034) | fn test_mut_iterator() {
function test_rev_iterator (line 10043) | fn test_rev_iterator() {
function test_mut_rev_iterator (line 10055) | fn test_mut_rev_iterator() {
function test_move_iterator (line 10064) | fn test_move_iterator() {
function test_move_rev_iterator (line 10070) | fn test_move_rev_iterator() {
function test_splitator (line 10076) | fn test_splitator() {
function test_splitator_inclusive (line 10096) | fn test_splitator_inclusive() {
function test_splitator_inclusive_reverse (line 10116) | fn test_splitator_inclusive_reverse() {
function test_splitator_mut_inclusive (line 10136) | fn test_splitator_mut_inclusive() {
function test_splitator_mut_inclusive_reverse (line 10156) | fn test_splitator_mut_inclusive_reverse() {
function test_splitnator (line 10176) | fn test_splitnator() {
function test_splitnator_mut (line 10192) | fn test_splitnator_mut() {
function test_rsplitator (line 10208) | fn test_rsplitator() {
function test_rsplitnator (line 10226) | fn test_rsplitnator() {
function test_windowsator (line 10243) | fn test_windowsator() {
function test_windowsator_0 (line 10259) | fn test_windowsator_0() {
function test_chunksator (line 10265) | fn test_chunksator() {
function test_chunksator_0 (line 10283) | fn test_chunksator_0() {
function test_chunks_exactator (line 10289) | fn test_chunks_exactator() {
function test_chunks_exactator_0 (line 10307) | fn test_chunks_exactator_0() {
function test_rchunksator (line 10313) | fn test_rchunksator() {
function test_rchunksator_0 (line 10331) | fn test_rchunksator_0() {
function test_rchunks_exactator (line 10337) | fn test_rchunks_exactator() {
function test_rchunks_exactator_0 (line 10355) | fn test_rchunks_exactator_0() {
function test_reverse_part (line 10361) | fn test_reverse_part() {
function test_show (line 10368) | fn test_show() {
function test_vec_default (line 10393) | fn test_vec_default() {
function test_overflow_does_not_cause_segfault (line 10407) | fn test_overflow_does_not_cause_segfault() {
function test_overflow_does_not_cause_segfault_managed (line 10416) | fn test_overflow_does_not_cause_segfault_managed() {
function test_mut_split_at (line 10423) | fn test_mut_split_at() {
type Foo (line 10448) | struct Foo;
function test_iter_zero_sized (line 10451) | fn test_iter_zero_sized() {
function test_shrink_to_fit (line 10490) | fn test_shrink_to_fit() {
function test_starts_with (line 10502) | fn test_starts_with() {
function test_ends_with (line 10516) | fn test_ends_with() {
function test_mut_splitator (line 10530) | fn test_mut_splitator() {
function test_mut_splitator_rev (line 10546) | fn test_mut_splitator_rev() {
function test_get_mut (line 10555) | fn test_get_mut() {
function test_mut_chunks (line 10565) | fn test_mut_chunks() {
function test_mut_chunks_rev (line 10578) | fn test_mut_chunks_rev() {
function test_mut_chunks_0 (line 10591) | fn test_mut_chunks_0() {
function test_mut_chunks_exact (line 10597) | fn test_mut_chunks_exact() {
function test_mut_chunks_exact_rev (line 10610) | fn test_mut_chunks_exact_rev() {
function test_mut_chunks_exact_0 (line 10623) | fn test_mut_chunks_exact_0() {
function test_mut_rchunks (line 10629) | fn test_mut_rchunks() {
function test_mut_rchunks_rev (line 10642) | fn test_mut_rchunks_rev() {
function test_mut_rchunks_0 (line 10655) | fn test_mut_rchunks_0() {
function test_mut_rchunks_exact (line 10661) | fn test_mut_rchunks_exact() {
function test_mut_rchunks_exact_rev (line 10674) | fn test_mut_rchunks_exact_rev() {
function test_mut_rchunks_exact_0 (line 10687) | fn test_mut_rchunks_exact_0() {
function test_mut_last (line 10693) | fn test_mut_last() {
function test_to_vec (line 10703) | fn test_to_vec() {
function test_in_place_iterator_specialization (line 10710) | fn test_in_place_iterator_specialization() {
function test_box_slice_clone (line 10719) | fn test_box_slice_clone() {
function test_box_slice_clone_panics (line 10729) | fn test_box_slice_clone_panics() {
function test_copy_from_slice (line 10773) | fn test_copy_from_slice() {
function test_copy_from_slice_dst_longer (line 10782) | fn test_copy_from_slice_dst_longer() {
function test_copy_from_slice_dst_shorter (line 10790) | fn test_copy_from_slice_dst_shorter() {
constant MAX_LEN (line 10796) | const MAX_LEN: usize = 80;
type DropCounter (line 10885) | struct DropCounter {
method eq (line 10892) | fn eq(&self, other: &Self) -> bool {
method partial_cmp (line 10898) | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
method cmp (line 10907) | fn cmp(&self, other: &Self) -> Ordering {
method drop (line 10913) | fn drop(&mut self) {
function panic_safe (line 10970) | fn panic_safe() {
function repeat_generic_slice (line 11022) | fn repeat_generic_slice() {
function subslice_patterns (line 11031) | fn subslice_patterns() {
function test_group_by (line 11149) | fn test_group_by() {
function test_group_by_mut (line 11178) | fn test_group_by_mut() {
function test_simple (line 11218) | fn test_simple() {
function test_parameterized (line 11252) | fn test_parameterized<T: Clone + PartialEq + Debug>(a: T, b: T, c: T, d:...
function test_push_front_grow (line 11283) | fn test_push_front_grow() {
function test_index (line 11305) | fn test_index() {
function test_index_out_of_bounds (line 11315) | fn test_index_out_of_bounds() {
function test_range_start_overflow (line 11325) | fn test_range_start_overflow() {
function test_range_end_overflow (line 11332) | fn test_range_end_overflow() {
type Taggy (line 11338) | enum Taggy {
type Taggypar (line 11345) | enum Taggypar<T> {
type RecCy (line 11352) | struct RecCy {
function test_param_int (line 11359) | fn test_param_int() {
function test_param_taggy (line 11364) | fn test_param_taggy() {
function test_param_taggypar (line 11369) | fn test_param_taggypar() {
function test_param_reccy (line 11379) | fn test_param_reccy() {
function test_with_capacity (line 11388) | fn test_with_capacity() {
function test_with_capacity_non_power_two (line 11398) | fn test_with_capacity_non_power_two() {
function test_reserve_exact (line 11439) | fn test_reserve_exact() {
function test_reserve (line 11447) | fn test_reserve() {
function test_swap (line 11455) | fn test_swap() {
function test_iter (line 11463) | fn test_iter() {
function test_rev_iter (line 11498) | fn test_rev_iter() {
function test_mut_rev_iter_wrap (line 11518) | fn test_mut_rev_iter_wrap() {
function test_mut_iter (line 11532) | fn test_mut_iter() {
function test_mut_rev_iter (line 11555) | fn test_mut_rev_iter() {
function test_into_iter (line 11578) | fn test_into_iter() {
function test_drain (line 11636) | fn test_drain() {
function test_from_iter (line 11702) | fn test_from_iter() {
function test_clone (line 11717) | fn test_clone() {
function test_eq (line 11734) | fn test_eq() {
function test_partial_eq_array (line 11755) | fn test_partial_eq_array() {
function test_hash (line 11774) | fn test_hash() {
function test_hash_after_rotation (line 11792) | fn test_hash_after_rotation() {
function test_eq_after_rotation (line 11811) | fn test_eq_after_rotation() {
function test_ord (line 11838) | fn test_ord() {
function test_show (line 11851) | fn test_show() {
function test_drop (line 11860) | fn test_drop() {
function test_drop_with_pop (line 11882) | fn test_drop_with_pop() {
function test_drop_clear (line 11908) | fn test_drop_clear() {
function test_drop_panic (line 11932) | fn test_drop_panic() {
function test_reserve_grow (line 11965) | fn test_reserve_grow() {
function test_get (line 12009) | fn test_get() {
function test_get_mut (line 12041) | fn test_get_mut() {
function test_front (line 12064) | fn test_front() {
function test_as_slices (line 12076) | fn test_as_slices() {
function test_as_mut_slices (line 12104) | fn test_as_mut_slices() {
function test_append (line 12132) | fn test_append() {
function test_append_permutations (line 12153) | fn test_append_permutations() {
type DropCounter (line 12228) | struct DropCounter<'a> {
method drop (line 12233) | fn drop(&mut self) {
function test_append_double_drop (line 12239) | fn test_append_double_drop() {
function test_retain (line 12254) | fn test_retain() {
function test_extend_ref (line 12263) | fn test_extend_ref() {
function test_contains (line 12289) | fn test_contains() {
function assert_covariance (line 12302) | fn assert_covariance() {
function test_is_empty (line 12309) | fn test_is_empty() {
function test_reserve_exact_2 (line 12330) | fn test_reserve_exact_2() {
function test_try_reserve (line 12355) | fn test_try_reserve() {
function test_try_reserve_exact (line 12470) | fn test_try_reserve_exact() {
function test_rotate_nop (line 12565) | fn test_rotate_nop() {
function test_rotate_left_parts (line 12623) | fn test_rotate_left_parts() {
function test_rotate_right_parts (line 12642) | fn test_rotate_right_parts() {
function test_rotate_left_random (line 12661) | fn test_rotate_left_random() {
function test_rotate_right_random (line 12679) | fn test_rotate_right_random() {
function test_try_fold_empty (line 12697) | fn test_try_fold_empty() {
function test_try_fold_none (line 12702) | fn test_try_fold_none() {
function test_try_fold_ok (line 12708) | fn test_try_fold_ok() {
function test_try_fold_unit (line 12714) | fn test_try_fold_unit() {
function test_try_fold_unit_none (line 12720) | fn test_try_fold_unit_none() {
function test_try_fold_rotated (line 12728) | fn test_try_fold_rotated() {
function test_try_fold_moves_iter (line 12741) | fn test_try_fold_moves_iter() {
function test_try_fold_exhaust_wrap (line 12749) | fn test_try_fold_exhaust_wrap() {
function test_try_fold_wraparound (line 12762) | fn test_try_fold_wraparound() {
function test_try_rfold_rotated (line 12775) | fn test_try_rfold_rotated() {
function test_try_rfold_moves_iter (line 12788) | fn test_try_rfold_moves_iter() {
function truncate_leak (line 12796) | fn truncate_leak() {
function test_drain_leak (line 12829) | fn test_drain_leak() {
function test_binary_search (line 12868) | fn test_binary_search() {
function test_binary_search_by (line 12891) | fn test_binary_search_by() {
function test_binary_search_by_key (line 12899) | fn test_binary_search_by_key() {
function test_partition_point (line 12907) | fn test_partition_point() {
function test_zero_sized_push (line 12925) | fn test_zero_sized_push() {
function test_from_zero_sized_vec (line 12955) | fn test_from_zero_sized_vec() {
function test_format (line 12966) | fn test_format() {
type A (line 12971) | struct A;
method fmt (line 12977) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type B (line 12972) | struct B;
method fmt (line 12982) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type C (line 12973) | struct C;
method fmt (line 12987) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type D (line 12974) | struct D;
method fmt (line 12992) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function test_format_macro_interface (line 13006) | fn test_format_macro_interface() {
function test_write (line 13196) | fn test_write() {
function test_print (line 13215) | fn test_print() {
function test_format_args (line 13226) | fn test_format_args() {
function test_order (line 13244) | fn test_order() {
function test_once (line 13261) | fn test_once() {
function test_refcell (line 13275) | fn test_refcell() {
function test_iterator (line 13290) | fn test_iterator() {
function test_iter_rev_cloned_collect (line 13302) | fn test_iter_rev_cloned_collect() {
function test_into_iter_collect (line 13312) | fn test_into_iter_collect() {
function test_into_iter_size_hint (line 13322) | fn test_into_iter_size_hint() {
function test_into_iter_rev_collect (line 13339) | fn test_into_iter_rev_collect() {
function test_into_iter_sorted_collect (line 13349) | fn test_into_iter_sorted_collect() {
function test_drain_sorted_collect (line 13357) | fn test_drain_sorted_collect() {
function check_exact_size_iterator (line 13364) | fn check_exact_size_iterator<I: ExactSizeIterator>(len: usize, it: I) {
function test_exact_size_iterator (line 13379) | fn test_exact_size_iterator() {
function check_trusted_len (line 13388) | fn check_trusted_len<I: TrustedLen>(len: usize, it: I) {
function test_trusted_len (line 13401) | fn test_trusted_len() {
function test_peek_and_pop (line 13408) | fn test_peek_and_pop() {
function test_peek_mut (line 13420) | fn test_peek_mut() {
function test_peek_mut_pop (line 13432) | fn test_peek_mut_pop() {
function test_push (line 13445) | fn test_push() {
function test_push_unique (line 13467) | fn test_push_unique() {
function check_to_vec (line 13488) | fn check_to_vec(mut data: Vec<i32>) {
function test_to_vec (line 13499) | fn test_to_vec() {
function test_in_place_iterator_specialization (line 13516) | fn test_in_place_iterator_specialization() {
function test_empty_pop (line 13528) | fn test_empty_pop() {
function test_empty_peek (line 13534) | fn test_empty_peek() {
function test_empty_peek_mut (line 13540) | fn test_empty_peek_mut() {
function test_from_iter (line 13546) | fn test_from_iter() {
function test_drain (line 13557) | fn test_drain() {
function test_drain_sorted (line 13566) | fn test_drain_sorted() {
function test_drain_sorted_leak (line 13575) | fn test_drain_sorted_leak() {
function test_extend_ref (line 13606) | fn test_extend_ref() {
function test_append (line 13631) | fn test_append() {
function test_append_to_empty (line 13642) | fn test_append_to_empty() {
function test_extend_specialization (line 13653) | fn test_extend_specialization() {
function assert_covariance (line 13663) | fn assert_covariance() {
function test_retain (line 13670) | fn test_retain() {
function panic_safe (line 13699) | fn panic_safe() {
function unitialized_zero_size_box (line 13777) | fn unitialized_zero_size_box() {
type Dummy (line 13793) | struct Dummy {
function box_clone_and_clone_from_equivalence (line 13798) | fn box_clone_and_clone_from_equivalence() {
function box_clone_from_ptr_stability (line 13815) | fn box_clone_from_ptr_stability() {
function box_deref_lval (line 13826) | fn box_deref_lval() {
function alloc_system_overaligned_request (line 13835) | fn alloc_system_overaligned_request() {
function std_heap_overaligned_request (line 13840) | fn std_heap_overaligned_request() {
function check_overalign_requests (line 13844) | fn check_overalign_requests<T: Allocator>(allocator: T) {
function __rust_alloc (line 14030) | fn __rust_alloc(size: usize, align: usize) -> *mut u8;
function __rust_dealloc (line 14032) | fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize);
function __rust_realloc (line 14034) | fn __rust_realloc(ptr: *mut u8, old_size: usize, align: usize, new_size:...
function __rust_alloc_zeroed (line 14036) | fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
type Global (line 14050) | pub struct Global;
method alloc_impl (line 14161) | fn alloc_impl(&self, layout: Layout, zeroed: bool) -> Result<NonNull<[...
method grow_impl (line 14175) | unsafe fn grow_impl(
function alloc (line 14085) | pub unsafe fn alloc(layout: Layout) -> *mut u8 {
function dealloc (line 14103) | pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
function realloc (line 14121) | pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> ...
function alloc_zeroed (line 14154) | pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
method allocate (line 14225) | fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
method allocate_zeroed (line 14230) | fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, Alloc...
method deallocate (line 14235) | unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
method grow (line 14244) | unsafe fn grow(
method grow_zeroed (line 14255) | unsafe fn grow_zeroed(
method shrink (line 14266) | unsafe fn shrink(
function exchange_malloc (line 14314) | unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
function box_free (line 14329) | pub(crate) unsafe fn box_free<T: ?Sized, A: Allocator>(ptr: Unique<T>, a...
function __rust_alloc_error_handler (line 14345) | fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
function handle_alloc_error (line 14364) | pub fn handle_alloc_error(layout: Layout) -> ! {
function __rdl_oom (line 14385) | pub unsafe extern "C" fn __rdl_oom(size: usize, _align: usize) -> ! {
function __rg_oom (line 14391) | pub unsafe extern "C" fn __rg_oom(size: usize, align: usize) -> ! {
type WriteCloneIntoRaw (line 14403) | pub(crate) trait WriteCloneIntoRaw: Sized {
method write_clone_into_raw (line 14404) | unsafe fn write_clone_into_raw(&self, target: *mut Self);
method write_clone_into_raw (line 14409) | default unsafe fn write_clone_into_raw(&self, target: *mut Self) {
method write_clone_into_raw (line 14418) | unsafe fn write_clone_into_raw(&self, target: *mut Self) {
type AllocInit (line 14441) | enum AllocInit {
type RawVec (line 14471) | pub struct RawVec<T, A: Allocator = Global> {
constant NEW (line 14483) | pub const NEW: Self = Self::new();
function new (line 14490) | pub const fn new() -> Self {
function with_capacity (line 14508) | pub fn with_capacity(capacity: usize) -> Self {
function with_capacity_zeroed (line 14514) | pub fn with_capacity_zeroed(capacity: usize) -> Self {
function from_raw_parts (line 14527) | pub unsafe fn from_raw_parts(ptr: *mut T, capacity: usize) -> Self {
constant MIN_NON_ZERO_CAP (line 14538) | const MIN_NON_ZERO_CAP: usize = if mem::size_of::<T>() == 1 {
function new_in (line 14549) | pub const fn new_in(alloc: A) -> Self {
function with_capacity_in (line 14557) | pub fn with_capacity_in(capacity: usize, alloc: A) -> Self {
function with_capacity_zeroed_in (line 14564) | pub fn with_capacity_zeroed_in(capacity: usize, alloc: A) -> Self {
function from_box (line 14569) | pub fn from_box(slice: Box<[T], A>) -> Self {
function into_box (line 14588) | pub unsafe fn into_box(self, len: usize) -> Box<[MaybeUninit<T>], A> {
function allocate_in (line 14602) | fn allocate_in(capacity: usize, init: AllocInit, alloc: A) -> Self {
function from_raw_parts_in (line 14644) | pub unsafe fn from_raw_parts_in(ptr: *mut T, capacity: usize, alloc: A) ...
function ptr (line 14652) | pub fn ptr(&self) -> *mut T {
function capacity (line 14660) | pub fn capacity(&self) -> usize {
function allocator (line 14665) | pub fn allocator(&self) -> &A {
function current_memory (line 14669) | fn current_memory(&self) -> Option<(NonNull<u8>, Layout)> {
function reserve (line 14735) | pub fn reserve(&mut self, len: usize, additional: usize) {
function try_reserve (line 14755) | pub fn try_reserve(&mut self, len: usize, additional: usize) -> Result<(...
function reserve_exact (line 14780) | pub fn reserve_exact(&mut self, len: usize, additional: usize) {
function try_reserve_exact (line 14785) | pub fn try_reserve_exact(
function shrink_to_fit (line 14803) | pub fn shrink_to_fit(&mut self, amount: usize) {
function needs_to_grow (line 14811) | fn needs_to_grow(&self, len: usize, additional: usize) -> bool {
function capacity_from_bytes (line 14815) | fn capacity_from_bytes(excess: usize) -> usize {
function set_ptr (line 14820) | fn set_ptr(&mut self, ptr: NonNull<[u8]>) {
function grow_amortized (line 14832) | fn grow_amortized(&mut self, len: usize, additional: usize) -> Result<()...
function grow_exact (line 14861) | fn grow_exact(&mut self, len: usize, additional: usize) -> Result<(), Tr...
function shrink (line 14877) | fn shrink(&mut self, amount: usize) -> Result<(), TryReserveError> {
function finish_grow (line 14900) | fn finish_grow<A>(
method drop (line 14929) | fn drop(&mut self) {
function handle_reserve (line 14938) | fn handle_reserve(result: Result<(), TryReserveError>) {
function alloc_guard (line 14956) | fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
function capacity_overflow (line 14967) | fn capacity_overflow() -> ! {
type Output (line 15048) | type Output = String;
function concat (line 15050) | fn concat(slice: &Self) -> String {
type Output (line 15057) | type Output = String;
function join (line 15059) | fn join(slice: &Self, sep: &str) -> String {
function join_generic_copy (line 15111) | fn join_generic_copy<B, T, S>(slice: &[S], sep: &[T]) -> Vec<T>
function into_boxed_bytes (line 15210) | pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
function replace (line 15240) | pub fn replace<'a, P: Pattern<'a>>(&'a self, from: P, to: &str) -> String {
function replacen (line 15278) | pub fn replacen<'a, P: Pattern<'a>>(&'a self, pat: P, to: &str, count: u...
function to_lowercase (line 15331) | pub fn to_lowercase(&self) -> String {
function to_uppercase (line 15410) | pub fn to_uppercase(&self) -> String {
function into_string (line 15443) | pub fn into_string(self: Box<str>) -> String {
function repeat (line 15469) | pub fn repeat(&self, n: usize) -> String {
function to_ascii_uppercase (line 15496) | pub fn to_ascii_uppercase(&self) -> String {
function to_ascii_lowercase (line 15526) | pub fn to_ascii_lowercase(&self) -> String {
function from_boxed_utf8_unchecked (line 15549) | pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
type Canary (line 15570) | struct Canary(*mut atomic::AtomicUsize);
method drop (line 15573) | fn drop(&mut self) {
function manually_share_arc (line 15586) | fn manually_share_arc() {
function test_arc_get_mut (line 15604) | fn test_arc_get_mut() {
function weak_counts (line 15617) | fn weak_counts() {
function try_unwrap (line 15644) | fn try_unwrap() {
function into_from_raw (line 15656) | fn into_from_raw() {
function test_into_from_raw_unsized (line 15673) | fn test_into_from_raw_unsized() {
function into_from_weak_raw (line 15695) | fn into_from_weak_raw() {
function test_into_from_weak_raw_unsized (line 15713) | fn test_into_from_weak_raw_unsized() {
function test_cowarc_clone_make_mut (line 15737) | fn test_cowarc_clone_make_mut() {
function test_cowarc_clone_unique2 (line 15761) | fn test_cowarc_clone_unique2() {
function test_cowarc_clone_weak (line 15783) | fn test_cowarc_clone_weak() {
function test_live (line 15797) | fn test_live() {
function test_dead (line 15804) | fn test_dead() {
function weak_self_cyclic (line 15812) | fn weak_self_cyclic() {
function drop_arc (line 15825) | fn drop_arc() {
function drop_arc_weak (line 15833) | fn drop_arc_weak() {
function test_strong_count (line 15844) | fn test_strong_count() {
function test_weak_count (line 15861) | fn test_weak_count() {
function show_arc (line 15887) | fn show_arc() {
type Foo (line 15894) | struct Foo {
function test_unsized (line 15899) | fn test_unsized() {
function test_maybe_thin_unsized (line 15908) | fn test_maybe_thin_unsized() {
function test_from_owned (line 15925) | fn test_from_owned() {
function test_new_weak (line 15932) | fn test_new_weak() {
function test_ptr_eq (line 15938) | fn test_ptr_eq() {
function test_weak_count_locked (line 15949) | fn test_weak_count_locked() {
function test_from_str (line 15971) | fn test_from_str() {
function test_copy_from_slice (line 15978) | fn test_copy_from_slice() {
function test_clone_from_slice (line 15986) | fn test_clone_from_slice() {
function test_clone_from_slice_panic (line 15998) | fn test_clone_from_slice_panic() {
function test_from_box (line 16020) | fn test_from_box() {
function test_from_box_str (line 16028) | fn test_from_box_str() {
function test_from_box_slice (line 16038) | fn test_from_box_slice() {
function test_from_box_trait (line 16046) | fn test_from_box_trait() {
function test_from_box_trait_zero_sized (line 16057) | fn test_from_box_trait_zero_sized() {
function test_from_vec (line 16067) | fn test_from_vec() {
function test_downcast (line 16075) | fn test_downcast() {
function test_array_from_slice (line 16095) | fn test_array_from_slice() {
function test_arc_cyclic_with_zero_refs (line 16107) | fn test_arc_cyclic_with_zero_refs() {
function test_arc_new_cyclic_one_ref (line 16124) | fn test_arc_new_cyclic_one_ref() {
function test_arc_cyclic_two_refs (line 16145) | fn test_arc_cyclic_two_refs() {
type String (line 16450) | pub struct String {
method into_cow (line 5632) | fn into_cow(self) -> Cow<'a, str> {
method borrow (line 15164) | fn borrow(&self) -> &str {
method borrow_mut (line 15172) | fn borrow_mut(&mut self) -> &mut str {
method new (line 16536) | pub const fn new() -> String {
method with_capacity (line 16581) | pub fn with_capacity(capacity: usize) -> String {
method from_str (line 16591) | pub fn from_str(_: &str) -> String {
method from_utf8 (line 16653) | pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
method from_utf8_lossy (line 16710) | pub fn from_utf8_lossy(v: &[u8]) -> Cow<'_, str> {
method from_utf16 (line 16762) | pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
method from_utf16_lossy (line 16802) | pub fn from_utf16_lossy(v: &[u16]) -> String {
method into_raw_parts (line 16833) | pub fn into_raw_parts(self) -> (*mut u8, usize, usize) {
method from_raw_parts (line 16884) | pub unsafe fn from_raw_parts(buf: *mut u8, length: usize, capacity: us...
method from_utf8_unchecked (line 16918) | pub unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String {
method into_bytes (line 16938) | pub fn into_bytes(self) -> Vec<u8> {
method as_str (line 16955) | pub fn as_str(&self) -> &str {
method as_mut_str (line 16975) | pub fn as_mut_str(&mut self) -> &mut str {
method push_str (line 16994) | pub fn push_str(&mut self, string: &str) {
method capacity (line 17011) | pub fn capacity(&self) -> usize {
method reserve (line 17061) | pub fn reserve(&mut self, additional: usize) {
method reserve_exact (line 17108) | pub fn reserve_exact(&mut self, additional: usize) {
method try_reserve (line 17143) | pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryRese...
method try_reserve_exact (line 17181) | pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), T...
method shrink_to_fit (line 17202) | pub fn shrink_to_fit(&mut self) {
method shrink_to (line 17229) | pub fn shrink_to(&mut self, min_capacity: usize) {
method push (line 17250) | pub fn push(&mut self, ch: char) {
method as_bytes (line 17274) | pub fn as_bytes(&self) -> &[u8] {
method truncate (line 17303) | pub fn truncate(&mut self, new_len: usize) {
method pop (line 17329) | pub fn pop(&mut self) -> Option<char> {
method remove (line 17361) | pub fn remove(&mut self, idx: usize) -> char {
method remove_matches (line 17397) | pub fn remove_matches<'a, P>(&'a mut self, pat: P)
method retain (line 17459) | pub fn retain<F>(&mut self, mut f: F)
method insert (line 17528) | pub fn insert(&mut self, idx: usize, ch: char) {
method insert_bytes (line 17538) | unsafe fn insert_bytes(&mut self, idx: usize, bytes: &[u8]) {
method insert_str (line 17573) | pub fn insert_str(&mut self, idx: usize, string: &str) {
method as_mut_vec (line 17607) | pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8> {
method len (line 17630) | pub fn len(&self) -> usize {
method is_empty (line 17649) | pub fn is_empty(&self) -> bool {
method split_off (line 17679) | pub fn split_off(&mut self, at: usize) -> String {
method clear (line 17705) | pub fn clear(&mut self) {
method drain (line 17738) | pub fn drain<R>(&mut self, range: R) -> Drain<'_>
method replace_range (line 17783) | pub fn replace_range<R>(&mut self, range: R, replace_with: &str)
method into_boxed_str (line 17830) | pub fn into_boxed_str(self) -> Box<str> {
method from_iter (line 17935) | fn from_iter<I: IntoIterator<Item = char>>(iter: I) -> String {
method from_iter (line 17944) | fn from_iter<I: IntoIterator<Item = &'a char>>(iter: I) -> String {
method from_iter (line 17953) | fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> String {
method from_iter (line 17962) | fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> String {
method from_iter (line 17980) | fn from_iter<I: IntoIterator<Item = Box<str>>>(iter: I) -> String {
method from_iter (line 17989) | fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String {
method extend (line 18008) | fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I) {
method extend_one (line 18016) | fn extend_one(&mut self, c: char) {
method extend_reserve (line 18021) | fn extend_reserve(&mut self, additional: usize) {
method extend (line 18028) | fn extend<I: IntoIterator<Item = &'a char>>(&mut self, iter: I) {
method extend_one (line 18033) | fn extend_one(&mut self, &c: &'a char) {
method extend_reserve (line 18038) | fn extend_reserve(&mut self, additional: usize) {
method extend (line 18045) | fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I) {
method extend_one (line 18050) | fn extend_one(&mut self, s: &'a str) {
method extend (line 18057) | fn extend<I: IntoIterator<Item = Box<str>>>(&mut self, iter: I) {
method extend (line 18064) | fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I) {
method extend_one (line 18069) | fn extend_one(&mut self, s: String) {
method extend (line 18076) | fn extend<I: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: I) {
method extend_one (line 18081) | fn extend_one(&mut self, s: Cow<'a, str>) {
method fmt (line 18191) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method fmt (line 18199) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method hash (line 18207) | fn hash<H: hash::Hasher>(&self, hasher: &mut H) {
type Output (line 18251) | type Output = String;
method add (line 18254) | fn add(mut self, other: &str) -> String {
method add_assign (line 18266) | fn add_assign(&mut self, other: &str) {
type Output (line 18273) | type Output = str;
method index (line 18276) | fn index(&self, index: ops::Range<usize>) -> &str {
type Output (line 18282) | type Output = str;
method index (line 18285) | fn index(&self, index: ops::RangeTo<usize>) -> &str {
type Output (line 18291) | type Output = str;
method index (line 18294) | fn index(&self, index: ops::RangeFrom<usize>) -> &str {
type Output (line 18300) | type Output = str;
method index (line 18303) | fn index(&self, _index: ops::RangeFull) -> &str {
type Output (line 18309) | type Output = str;
method index (line 18312) | fn index(&self, index: ops::RangeInclusive<usize>) -> &str {
type Output (line 18318) | type Output = str;
method index (line 18321) | fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
method index_mut (line 18329) | fn index_mut(&mut self, index: ops::Range<usize>) -> &mut str {
method index_mut (line 18336) | fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut str {
method index_mut (line 18343) | fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut str {
method index_mut (line 18350) | fn index_mut(&mut self, _index: ops::RangeFull) -> &mut str {
method index_mut (line 18357) | fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut str {
method index_mut (line 18364) | fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut s...
type Target (line 18371) | type Target = str;
method deref (line 18374) | fn deref(&self) -> &str {
method deref_mut (line 18382) | fn deref_mut(&mut self) -> &mut str {
method as_ref (line 18489) | fn as_ref(&self) -> &str {
method as_mut (line 18497) | fn as_mut(&mut self) -> &mut str {
method as_ref (line 18505) | fn as_ref(&self) -> &[u8] {
method from (line 18513) | fn from(s: &str) -> String {
method from (line 18524) | fn from(s: &mut str) -> String {
method from (line 18532) | fn from(s: &String) -> String {
method from (line 18555) | fn from(s: Box<str>) -> String {
method from (line 18582) | fn from(s: Cow<'a, str>) -> String {
method write_str (line 18689) | fn write_str(&mut self, s: &str) -> fmt::Result {
method write_char (line 18695) | fn write_char(&mut self, c: char) -> fmt::Result {
method from (line 18812) | fn from(c: char) -> Self {
type FromUtf8Error (line 16489) | pub struct FromUtf8Error {
method as_bytes (line 17852) | pub fn as_bytes(&self) -> &[u8] {
method into_bytes (line 17875) | pub fn into_bytes(self) -> Vec<u8> {
method utf8_error (line 17903) | pub fn utf8_error(&self) -> Utf8Error {
method fmt (line 17910) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type FromUtf16Error (line 16512) | pub struct FromUtf16Error(());
method fmt (line 17917) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method clone (line 17924) | fn clone(&self) -> Self {
method clone_from (line 17928) | fn clone_from(&mut self, source: &Self) {
type Searcher (line 18099) | type Searcher = <&'b str as Pattern<'a>>::Searcher;
function into_searcher (line 18101) | fn into_searcher(self, haystack: &'a str) -> <&'b str as Pattern<'a>>::S...
function is_contained_in (line 18106) | fn is_contained_in(self, haystack: &'a str) -> bool {
function is_prefix_of (line 18111) | fn is_prefix_of(self, haystack: &'a str) -> bool {
function strip_prefix_of (line 18116) | fn strip_prefix_of(self, haystack: &'a str) -> Option<&'a str> {
function is_suffix_of (line 18121) | fn is_suffix_of(self, haystack: &'a str) -> bool {
function strip_suffix_of (line 18126) | fn strip_suffix_of(self, haystack: &'a str) -> Option<&'a str> {
method eq (line 18134) | fn eq(&self, other: &String) -> bool {
method ne (line 18138) | fn ne(&self, other: &String) -> bool {
method default (line 18183) | fn default() -> String {
type ParseError (line 18393) | pub type ParseError = core::convert::Infallible;
type Err (line 18397) | type Err = core::convert::Infallible;
method from_str (line 18399) | fn from_str(s: &str) -> Result<String, Self::Err> {
type ToString (line 18414) | pub trait ToString {
method to_string (line 18429) | fn to_string(&self) -> String;
method to_string (line 18445) | default fn to_string(&self) -> String {
method to_string (line 18457) | fn to_string(&self) -> String {
method to_string (line 18465) | fn to_string(&self) -> String {
method to_string (line 18473) | fn to_string(&self) -> String {
method to_string (line 18481) | fn to_string(&self) -> String {
function from (line 18575) | fn from(s: String) -> Box<str> {
function from (line 18600) | fn from(s: &'a str) -> Cow<'a, str> {
function from (line 18620) | fn from(s: String) -> Cow<'a, str> {
function from (line 18639) | fn from(s: &'a String) -> Cow<'a, str> {
function from_iter (line 18646) | fn from_iter<I: IntoIterator<Item = char>>(it: I) -> Cow<'a, str> {
function from_iter (line 18653) | fn from_iter<I: IntoIterator<Item = &'b str>>(it: I) -> Cow<'a, str> {
function from_iter (line 18660) | fn from_iter<I: IntoIterator<Item = String>>(it: I) -> Cow<'a, str> {
function from (line 18681) | fn from(string: String) -> Vec<u8> {
type Drain (line 18708) | pub struct Drain<'a> {
function fmt (line 18721) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method drop (line 18733) | fn drop(&mut self) {
function as_str (line 18759) | pub fn as_str(&self) -> &str {
type Item (line 18781) | type Item = char;
method next (line 18784) | fn next(&mut self) -> Option<char> {
method size_hint (line 18788) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 18793) | fn last(mut self) -> Option<char> {
method next_back (line 18801) | fn next_back(&mut self) -> Option<char> {
function borrow (line 18838) | fn borrow(&self) -> &B {
type ToOwned (line 18851) | pub trait ToOwned {
type Owned (line 15179) | type Owned = String;
method to_owned (line 15181) | fn to_owned(&self) -> String {
method clone_into (line 15185) | fn clone_into(&self, target: &mut String) {
method to_owned (line 18871) | fn to_owned(&self) -> Self::Owned;
method clone_into (line 18890) | fn clone_into(&self, target: &mut Self::Owned) {
type Owned (line 18900) | type Owned = T;
method to_owned (line 18901) | fn to_owned(&self) -> T {
method clone_into (line 18905) | fn clone_into(&self, target: &mut T) {
type Owned (line 22777) | type Owned = Vec<T>;
method to_owned (line 22779) | fn to_owned(&self) -> Vec<T> {
method to_owned (line 22784) | fn to_owned(&self) -> Vec<T> {
method clone_into (line 22788) | fn clone_into(&self, target: &mut Vec<T>) {
type Cow (line 18992) | pub enum Cow<'a, B: ?Sized + 'a>
method clone (line 19007) | fn clone(&self) -> Self {
method clone_from (line 19017) | fn clone_from(&mut self, source: &Self) {
function is_borrowed (line 19042) | pub const fn is_borrowed(&self) -> bool {
function is_owned (line 19065) | pub const fn is_owned(&self) -> bool {
function to_mut (line 19087) | pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned {
function into_owned (line 19135) | pub fn into_owned(self) -> <B as ToOwned>::Owned {
type Target (line 19145) | type Target = B;
method deref (line 19147) | fn deref(&self) -> &B {
method cmp (line 19164) | fn cmp(&self, other: &Self) -> Ordering {
function eq (line 19176) | fn eq(&self, other: &Cow<'b, C>) -> bool {
method partial_cmp (line 19187) | fn partial_cmp(&self, other: &Cow<'a, B>) -> Option<Ordering> {
function fmt (line 19197) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function fmt (line 19210) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method default (line 19224) | fn default() -> Self {
method hash (line 19235) | fn hash<H: Hasher>(&self, state: &mut H) {
function as_ref (line 19242) | fn as_ref(&self) -> &T {
type Output (line 19249) | type Output = Cow<'a, str>;
function add (line 19252) | fn add(mut self, rhs: &'a str) -> Self::Output {
type Output (line 19260) | type Output = Cow<'a, str>;
function add (line 19263) | fn add(mut self, rhs: Cow<'a, str>) -> Self::Output {
function add_assign (line 19271) | fn add_assign(&mut self, rhs: &'a str) {
function add_assign (line 19287) | fn add_assign(&mut self, rhs: Cow<'a, str>) {
type RcBox (line 19775) | struct RcBox<T: ?Sized> {
type Rc (line 19793) | pub struct Rc<T: ?Sized> {
function inner (line 19811) | fn inner(&self) -> &RcBox<T> {
function from_inner (line 19817) | fn from_inner(ptr: NonNull<RcBox<T>>) -> Self {
function from_ptr (line 19821) | unsafe fn from_ptr(ptr: *mut RcBox<T>) -> Self {
function new (line 19837) | pub fn new(value: T) -> Rc<T> {
function new_cyclic (line 19872) | pub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> Rc<T> {
function new_uninit (line 19933) | pub fn new_uninit() -> Rc<mem::MaybeUninit<T>> {
function new_zeroed (line 19964) | pub fn new_zeroed() -> Rc<mem::MaybeUninit<T>> {
function try_new (line 19986) | pub fn try_new(value: T) -> Result<Rc<T>, AllocError> {
function try_new_uninit (line 20021) | pub fn try_new_uninit() -> Result<Rc<mem::MaybeUninit<T>>, AllocError> {
function try_new_zeroed (line 20054) | pub fn try_new_zeroed() -> Result<Rc<mem::MaybeUninit<T>>, AllocError> {
function pin (line 20066) | pub fn pin(value: T) -> Pin<Rc<T>> {
function try_unwrap (line 20091) | pub fn try_unwrap(this: Self) -> Result<T, Self> {
function new_uninit_slice (line 20136) | pub fn new_uninit_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]> {
function new_zeroed_slice (line 20161) | pub fn new_zeroed_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]> {
function assume_init (line 20209) | pub unsafe fn assume_init(self) -> Rc<T> {
function assume_init (line 20250) | pub unsafe fn assume_init(self) -> Rc<[T]> {
function into_raw (line 20273) | pub fn into_raw(this: Self) -> *const T {
function as_ptr (line 20296) | pub fn as_ptr(this: &Self) -> *const T {
function from_raw (line 20343) | pub unsafe fn from_raw(ptr: *const T) -> Self {
function downgrade (line 20365) | pub fn downgrade(this: &Self) -> Weak<T> {
function weak_count (line 20386) | pub fn weak_count(this: &Self) -> usize {
function strong_count (line 20404) | pub fn strong_count(this: &Self) -> usize {
function increment_strong_count (line 20434) | pub unsafe fn increment_strong_count(ptr: *const T) {
function decrement_strong_count (line 20471) | pub unsafe fn decrement_strong_count(ptr: *const T) {
function is_unique (line 20478) | fn is_unique(this: &Self) -> bool {
function get_mut (line 20508) | pub fn get_mut(this: &mut Self) -> Option<&mut T> {
function get_mut_unchecked (line 20541) | pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T {
function ptr_eq (line 20566) | pub fn ptr_eq(this: &Self, other: &Self) -> bool {
function make_mut (line 20622) | pub fn make_mut(this: &mut Self) -> &mut T {
function downcast (line 20676) | pub fn downcast<T: Any>(self) -> Result<Rc<T>, Rc<dyn Any>> {
function allocate_for_layout (line 20693) | unsafe fn allocate_for_layout(
function try_allocate_for_layout (line 20716) | unsafe fn try_allocate_for_layout(
function allocate_for_ptr (line 20743) | unsafe fn allocate_for_ptr(ptr: *const T) -> *mut RcBox<T> {
function from_box (line 20754) | fn from_box(v: Box<T>) -> Rc<T> {
function allocate_for_slice (line 20779) | unsafe fn allocate_for_slice(len: usize) -> *mut RcBox<[T]> {
function copy_from_slice (line 20792) | unsafe fn copy_from_slice(v: &[T]) -> Rc<[T]> {
function from_iter_exact (line 20803) | unsafe fn from_iter_exact(iter: impl iter::Iterator<Item = T>, len: usiz...
type RcFromSlice (line 20850) | trait RcFromSlice<T> {
method from_slice (line 20851) | fn from_slice(slice: &[T]) -> Self;
function from_slice (line 20856) | default fn from_slice(v: &[T]) -> Self {
function from_slice (line 20863) | fn from_slice(v: &[T]) -> Self {
type Target (line 20870) | type Target = T;
method deref (line 20873) | fn deref(&self) -> &T {
method drop (line 20908) | fn drop(&mut self) {
method clone (line 20944) | fn clone(&self) -> Rc<T> {
method default (line 20963) | fn default() -> Rc<T> {
type RcEqIdent (line 20969) | trait RcEqIdent<T: ?Sized + PartialEq> {
method eq (line 20970) | fn eq(&self, other: &Rc<T>) -> bool;
method ne (line 20971) | fn ne(&self, other: &Rc<T>) -> bool;
function eq (line 20977) | default fn eq(&self, other: &Rc<T>) -> bool {
function ne (line 20982) | default fn ne(&self, other: &Rc<T>) -> bool {
type MarkerEq (line 20989) | pub(crate) trait MarkerEq: PartialEq<Self> {}
function eq (line 21003) | fn eq(&self, other: &Rc<T>) -> bool {
function ne (line 21008) | fn ne(&self, other: &Rc<T>) -> bool {
method eq (line 21034) | fn eq(&self, other: &Rc<T>) -> bool {
method ne (line 21056) | fn ne(&self, other: &Rc<T>) -> bool {
method partial_cmp (line 21081) | fn partial_cmp(&self, other: &Rc<T>) -> Option<Ordering> {
method lt (line 21099) | fn lt(&self, other: &Rc<T>) -> bool {
method le (line 21117) | fn le(&self, other: &Rc<T>) -> bool {
method gt (line 21135) | fn gt(&self, other: &Rc<T>) -> bool {
method ge (line 21153) | fn ge(&self, other: &Rc<T>) -> bool {
method cmp (line 21175) | fn cmp(&self, other: &Rc<T>) -> Ordering {
method hash (line 21182) | fn hash<H: Hasher>(&self, state: &mut H) {
function fmt (line 21189) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function fmt (line 21196) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function fmt (line 21203) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function from (line 21210) | fn from(t: T) -> Self {
function from (line 21228) | fn from(v: &[T]) -> Rc<[T]> {
function from (line 21245) | fn from(v: &str) -> Rc<str> {
function from (line 21264) | fn from(v: String) -> Rc<str> {
function from (line 21282) | fn from(v: Box<T>) -> Rc<T> {
function from (line 21300) | fn from(mut v: Vec<T>) -> Rc<[T]> {
function from (line 21319) | fn from(cow: Cow<'a, B>) -> Rc<B> {
type Error (line 21329) | type Error = Rc<[T]>;
function try_from (line 21331) | fn try_from(boxed_slice: Rc<[T]>) -> Result<Self, Self::Error> {
function from_iter (line 21380) | fn from_iter<I: iter::IntoIterator<Item = T>>(iter: I) -> Self {
type ToRcSlice (line 21386) | trait ToRcSlice<T>: Iterator<Item = T> + Sized {
method to_rc_slice (line 21387) | fn to_rc_slice(self) -> Rc<[T]>;
method to_rc_slice (line 21391) | default fn to_rc_slice(self) -> Rc<[T]> {
method to_rc_slice (line 21397) | fn to_rc_slice(self) -> Rc<[T]> {
type Weak (line 21443) | pub struct Weak<T: ?Sized> {
function new (line 21479) | pub fn new() -> Weak<T> {
function is_dangling (line 21484) | pub(crate) fn is_dangling<T: ?Sized>(ptr: *mut T) -> bool {
type WeakInner (line 21491) | struct WeakInner<'a> {
function as_ptr (line 21523) | pub fn as_ptr(&self) -> *const T {
function into_raw (line 21566) | pub fn into_raw(self) -> *const T {
function from_raw (line 21615) | pub unsafe fn from_raw(ptr: *const T) -> Self {
function upgrade (line 21658) | pub fn upgrade(&self) -> Option<Rc<T>> {
function strong_count (line 21672) | pub fn strong_count(&self) -> usize {
function weak_count (line 21680) | pub fn weak_count(&self) -> usize {
function inner (line 21695) | fn inner(&self) -> Option<WeakInner<'_>> {
function ptr_eq (line 21752) | pub fn ptr_eq(&self, other: &Self) -> bool {
method drop (line 21783) | fn drop(&mut self) {
method clone (line 21811) | fn clone(&self) -> Weak<T> {
function fmt (line 21821) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method default (line 21842) | fn default() -> Weak<T> {
type RcInnerPtr (line 21857) | trait RcInnerPtr {
method weak_ref (line 21858) | fn weak_ref(&self) -> &Cell<usize>;
method strong_ref (line 21859) | fn strong_ref(&self) -> &Cell<usize>;
method strong (line 21862) | fn strong(&self) -> usize {
method inc_strong (line 21867) | fn inc_strong(&self) {
method dec_strong (line 21881) | fn dec_strong(&self) {
method weak (line 21886) | fn weak(&self) -> usize {
method inc_weak (line 21891) | fn inc_weak(&self) {
method dec_weak (line 21905) | fn dec_weak(&self) {
method weak_ref (line 21912) | fn weak_ref(&self) -> &Cell<usize> {
method strong_ref (line 21917) | fn strong_ref(&self) -> &Cell<usize> {
method weak_ref (line 21924) | fn weak_ref(&self) -> &Cell<usize> {
method strong_ref (line 21929) | fn strong_ref(&self) -> &Cell<usize> {
function borrow (line 21936) | fn borrow(&self) -> &T {
function as_ref (line 21943) | fn as_ref(&self) -> &T {
function data_offset (line 21957) | unsafe fn data_offset<T: ?Sized>(ptr: *const T) -> isize {
function data_offset_align (line 21968) | fn data_offset_align(align: usize) -> isize {
function into_vec (line 22124) | pub fn into_vec<T, A: Allocator>(b: Box<[T], A>) -> Vec<T, A> {
function to_vec (line 22133) | pub fn to_vec<T: ConvertVec, A: Allocator>(s: &[T], alloc: A) -> Vec<T, ...
type ConvertVec (line 22137) | pub trait ConvertVec {
method to_vec (line 22138) | fn to_vec<A: Allocator>(s: &[Self], alloc: A) -> Vec<Self, A>
method to_vec (line 22145) | default fn to_vec<A: Allocator>(s: &[Self], alloc: A) -> Vec<Self, A> {
method to_vec (line 22181) | fn to_vec<A: Allocator>(s: &[Self], alloc: A) -> Vec<Self, A> {
function sort (line 22226) | pub fn sort(&mut self)
function sort_by (line 22280) | pub fn sort_by<F>(&mut self, mut compare: F)
function sort_by_key (line 22320) | pub fn sort_by_key<K, F>(&mut self, mut f: F)
function sort_by_cached_key (line 22362) | pub fn sort_by_cached_key<K, F>(&mut self, f: F)
function to_vec (line 22420) | pub fn to_vec(&self) -> Vec<T>
function to_vec_in (line 22442) | pub fn to_vec_in<A: Allocator>(&self, alloc: A) -> Vec<T, A>
function into_vec (line 22466) | pub fn into_vec<A: Allocator>(self: Box<Self, A>) -> Vec<T, A> {
function repeat (line 22492) | pub fn repeat(&self, n: usize) -> Vec<T>
function concat (line 22559) | pub fn concat<Item: ?Sized>(&self) -> <Self as Concat<Item>>::Output
function join (line 22577) | pub fn join<Separator>(&self, sep: Separator) -> <Self as Join<Separator...
function connect (line 22596) | pub fn connect<Separator>(&self, sep: Separator) -> <Self as Join<Separa...
function to_ascii_uppercase (line 22618) | pub fn to_ascii_uppercase(&self) -> Vec<u8> {
function to_ascii_lowercase (line 22635) | pub fn to_ascii_lowercase(&self) -> Vec<u8> {
type Concat (line 22676) | pub trait Concat<Item: ?Sized> {
method concat (line 22683) | fn concat(slice: &Self) -> Self::Output;
type Join (line 22688) | pub trait Join<Separator> {
method join (line 22695) | fn join(slice: &Self, sep: Separator) -> Self::Output;
type Output (line 22700) | type Output = Vec<T>;
function concat (line 22702) | fn concat(slice: &Self) -> Vec<T> {
type Output (line 22714) | type Output = Vec<T>;
function join (line 22716) | fn join(slice: &Self, sep: &T) -> Vec<T> {
type Output (line 22736) | type Output = Vec<T>;
function join (line 22738) | fn join(slice: &Self, sep: &[T]) -> Vec<T> {
function borrow (line 22763) | fn borrow(&self) -> &[T] {
function borrow_mut (line 22770) | fn borrow_mut(&mut self) -> &mut [T] {
function insert_head (line 22809) | fn insert_head<T, F>(v: &mut [T], is_less: &mut F)
function merge (line 22880) | unsafe fn merge<T, F>(v: &mut [T], mid: usize, buf: *mut T, is_less: &mu...
function merge_sort (line 23000) | fn merge_sort<T, F>(v: &mut [T], mut is_less: F)
type Wake (line 23193) | pub trait Wake {
method wake (line 23196) | fn wake(self: Arc<Self>);
method wake_by_ref (line 23206) | fn wake_by_ref(self: &Arc<Self>) {
method from (line 23216) | fn from(waker: Arc<W>) -> Waker {
method from (line 23228) | fn from(waker: Arc<W>) -> RawWaker {
function raw_waker (line 23239) | fn raw_waker<W: Wake + Send + Sync + 'static>(waker: Arc<W>) -> RawWaker {
constant MAX_REFCOUNT (line 23311) | const MAX_REFCOUNT: usize = (isize::MAX) as usize;
type Arc (line 23495) | pub struct Arc<T: ?Sized> {
function from_inner (line 23512) | fn from_inner(ptr: NonNull<ArcInner<T>>) -> Self {
function from_ptr (line 23516) | unsafe fn from_ptr(ptr: *mut ArcInner<T>) -> Self {
type Weak (line 23542) | pub struct Weak<T: ?Sized> {
function fmt (line 23564) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type ArcInner (line 23573) | struct ArcInner<T: ?Sized> {
function new (line 23599) | pub fn new(data: T) -> Arc<T> {
function new_cyclic (line 23632) | pub fn new_cyclic(data_fn: impl FnOnce(&Weak<T>) -> T) -> Arc<T> {
function new_uninit (line 23705) | pub fn new_uninit() -> Arc<mem::MaybeUninit<T>> {
function new_zeroed (line 23736) | pub fn new_zeroed() -> Arc<mem::MaybeUninit<T>> {
function pin (line 23749) | pub fn pin(data: T) -> Pin<Arc<T>> {
function try_new (line 23766) | pub fn try_new(data: T) -> Result<Arc<T>, AllocError> {
function try_new_uninit (line 23802) | pub fn try_new_uninit() -> Result<Arc<mem::MaybeUninit<T>>, AllocError> {
function try_new_zeroed (line 23835) | pub fn try_new_zeroed() -> Result<Arc<mem::MaybeUninit<T>>, AllocError> {
function try_unwrap (line 23865) | pub fn try_unwrap(this: Self) -> Result<T, Self> {
function new_uninit_slice (line 23909) | pub fn new_uninit_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
function new_zeroed_slice (line 23934) | pub fn new_zeroed_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
function assume_init (line 23982) | pub unsafe fn assume_init(self) -> Arc<T> {
function assume_init (line 24023) | pub unsafe fn assume_init(self) -> Arc<[T]> {
function into_raw (line 24044) | pub fn into_raw(this: Self) -> *const T {
function as_ptr (line 24067) | pub fn as_ptr(this: &Self) -> *const T {
function from_raw (line 24114) | pub unsafe fn from_raw(ptr: *const T) -> Self {
function downgrade (line 24137) | pub fn downgrade(this: &Self) -> Weak<T> {
function weak_count (line 24190) | pub fn weak_count(this: &Self) -> usize {
function strong_count (line 24219) | pub fn strong_count(this: &Self) -> usize {
function increment_strong_count (line 24251) | pub unsafe fn increment_strong_count(ptr: *const T) {
function decrement_strong_count (line 24290) | pub unsafe fn decrement_strong_count(ptr: *const T) {
function inner (line 24295) | fn inner(&self) -> &ArcInner<T> {
function drop_slow (line 24306) | unsafe fn drop_slow(&mut self) {
function ptr_eq (line 24334) | pub fn ptr_eq(this: &Self, other: &Self) -> bool {
function allocate_for_layout (line 24345) | unsafe fn allocate_for_layout(
function try_allocate_for_layout (line 24367) | unsafe fn try_allocate_for_layout(
function allocate_for_ptr (line 24393) | unsafe fn allocate_for_ptr(ptr: *const T) -> *mut ArcInner<T> {
function from_box (line 24404) | fn from_box(v: Box<T>) -> Arc<T> {
function allocate_for_slice (line 24429) | unsafe fn allocate_for_slice(len: usize) -> *mut ArcInner<[T]> {
function copy_from_slice (line 24442) | unsafe fn copy_from_slice(v: &[T]) -> Arc<[T]> {
function from_iter_exact (line 24455) | unsafe fn from_iter_exact(iter: impl iter::Iterator<Item = T>, len: usiz...
type ArcFromSlice (line 24502) | trait ArcFromSlice<T> {
method from_slice (line 24503) | fn from_slice(slice: &[T]) -> Self;
function from_slice (line 24508) | default fn from_slice(v: &[T]) -> Self {
function from_slice (line 24515) | fn from_slice(v: &[T]) -> Self {
method clone (line 24537) | fn clone(&self) -> Arc<T> {
type Target (line 24570) | type Target = T;
method deref (line 24573) | fn deref(&self) -> &T {
function make_mut (line 24616) | pub fn make_mut(this: &mut Self) -> &mut T {
function get_mut (line 24697) | pub fn get_mut(this: &mut Self) -> Option<&mut T> {
function get_mut_unchecked (line 24739) | pub unsafe fn get_mut_unchecked(this: &mut Self) -> &mut T {
function is_unique (line 24749) | fn is_unique(&mut self) -> bool {
method drop (line 24802) | fn drop(&mut self) {
function downcast (line 24867) | pub fn downcast<T>(self) -> Result<Arc<T>, Self>
function new (line 24896) | pub fn new() -> Weak<T> {
type WeakInner (line 24903) | struct WeakInner<'a> {
function as_ptr (line 24935) | pub fn as_ptr(&self) -> *const T {
function into_raw (line 24978) | pub fn into_raw(self) -> *const T {
function from_raw (line 25027) | pub unsafe fn from_raw(ptr: *const T) -> Self {
function upgrade (line 25072) | pub fn upgrade(&self) -> Option<Arc<T>> {
function strong_count (line 25109) | pub fn strong_count(&self) -> usize {
function weak_count (line 25125) | pub fn weak_count(&self) -> usize {
function inner (line 25147) | fn inner(&self) -> Option<WeakInner<'_>> {
function ptr_eq (line 25204) | pub fn ptr_eq(&self, other: &Self) -> bool {
method clone (line 25223) | fn clone(&self) -> Weak<T> {
method default (line 25260) | fn default() -> Weak<T> {
method drop (line 25291) | fn drop(&mut self) {
type ArcEqIdent (line 25310) | trait ArcEqIdent<T: ?Sized + PartialEq> {
method eq (line 25311) | fn eq(&self, other: &Arc<T>) -> bool;
method ne (line 25312) | fn ne(&self, other: &Arc<T>) -> bool;
function eq (line 25318) | default fn eq(&self, other: &Arc<T>) -> bool {
function ne (line 25322) | default fn ne(&self, other: &Arc<T>) -> bool {
function eq (line 25337) | fn eq(&self, other: &Arc<T>) -> bool {
function ne (line 25342) | fn ne(&self, other: &Arc<T>) -> bool {
method eq (line 25367) | fn eq(&self, other: &Arc<T>) -> bool {
method ne (line 25388) | fn ne(&self, other: &Arc<T>) -> bool {
method partial_cmp (line 25409) | fn partial_cmp(&self, other: &Arc<T>) -> Option<Ordering> {
method lt (line 25426) | fn lt(&self, other: &Arc<T>) -> bool {
method le (line 25443) | fn le(&self, other: &Arc<T>) -> bool {
method gt (line 25460) | fn gt(&self, other: &Arc<T>) -> bool {
method ge (line 25477) | fn ge(&self, other: &Arc<T>) -> bool {
method cmp (line 25497) | fn cmp(&self, other: &Arc<T>) -> Ordering {
function fmt (line 25506) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function fmt (line 25513) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function fmt (line 25520) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method default (line 25537) | fn default() -> Arc<T> {
method hash (line 25544) | fn hash<H: Hasher>(&self, state: &mut H) {
function from (line 25551) | fn from(t: T) -> Self {
function from (line 25569) | fn from(v: &[T]) -> Arc<[T]> {
function from (line 25586) | fn from(v: &str) -> Arc<str> {
function from (line 25605) | fn from(v: String) -> Arc<str> {
function from (line 25623) | fn from(v: Box<T>) -> Arc<T> {
function from (line 25641) | fn from(mut v: Vec<T>) -> Arc<[T]> {
function from (line 25660) | fn from(cow: Cow<'a, B>) -> Arc<B> {
type Error (line 25670) | type Error = Arc<[T]>;
function try_from (line 25672) | fn try_from(boxed_slice: Arc<[T]>) -> Result<Self, Self::Error> {
function from_iter (line 25721) | fn from_iter<I: iter::IntoIterator<Item = T>>(iter: I) -> Self {
type ToArcSlice (line 25727) | trait ToArcSlice<T>: Iterator<Item = T> + Sized {
method to_arc_slice (line 25728) | fn to_arc_slice(self) -> Arc<[T]>;
method to_arc_slice (line 25732) | default fn to_arc_slice(self) -> Arc<[T]> {
method to_arc_slice (line 25738) | fn to_arc_slice(self) -> Arc<[T]> {
function borrow (line 25765) | fn borrow(&self) -> &T {
function as_ref (line 25772) | fn as_ref(&self) -> &T {
function data_offset (line 25786) | unsafe fn data_offset<T: ?Sized>(ptr: *const T) -> isize {
function data_offset_align (line 25797) | fn data_offset_align(align: usize) -> isize {
function format (line 26378) | pub fn format(args: Arguments<'_>) -> string::String {
function test_clone (line 26395) | fn test_clone() {
function test_simple (line 26403) | fn test_simple() {
function test_simple_clone (line 26409) | fn test_simple_clone() {
function test_destructor (line 26417) | fn test_destructor() {
function test_live (line 26423) | fn test_live() {
function test_dead (line 26430) | fn test_dead() {
function weak_self_cyclic (line 26438) | fn weak_self_cyclic() {
function is_unique (line 26451) | fn is_unique() {
function test_strong_count (line 26465) | fn test_strong_count() {
function test_weak_count (line 26482) | fn test_weak_count() {
function weak_counts (line 26499) | fn weak_counts() {
function try_unwrap (line 26526) | fn try_unwrap() {
function into_from_raw (line 26538) | fn into_from_raw() {
function test_into_from_raw_unsized (line 26555) | fn test_into_from_raw_unsized() {
function into_from_weak_raw (line 26577) | fn into_from_weak_raw() {
function test_into_from_weak_raw_unsized (line 26595) | fn test_into_from_weak_raw_unsized() {
function get_mut (line 26619) | fn get_mut() {
function test_cowrc_clone_make_unique (line 26632) | fn test_cowrc_clone_make_unique() {
function test_cowrc_clone_unique2 (line 26656) | fn test_cowrc_clone_unique2() {
function test_cowrc_clone_weak (line 26679) | fn test_cowrc_clone_weak() {
function test_show (line 26693) | fn test_show() {
function test_unsized (line 26699) | fn test_unsized() {
function test_maybe_thin_unsized (line 26705) | fn test_maybe_thin_unsized() {
function test_from_owned (line 26722) | fn test_from_owned() {
function test_new_weak (line 26729) | fn test_new_weak() {
function test_ptr_eq (line 26735) | fn test_ptr_eq() {
function test_from_str (line 26745) | fn test_from_str() {
function test_copy_from_slice (line 26752) | fn test_copy_from_slice() {
function test_clone_from_slice (line 26760) | fn test_clone_from_slice() {
function test_clone_from_slice_panic (line 26772) | fn test_clone_from_slice_panic() {
function test_from_box (line 26794) | fn test_from_box() {
function test_from_box_str (line 26802) | fn test_from_box_str() {
function test_from_box_slice (line 26812) | fn test_from_box_slice() {
function test_from_box_trait (line 26820) | fn test_from_box_trait() {
function test_from_box_trait_zero_sized (line 26831) | fn test_from_box_trait_zero_sized() {
function test_from_vec (line 26841) | fn test_from_vec() {
function test_downcast (line 26849) | fn test_downcast() {
function test_array_from_slice (line 26869) | fn test_array_from_slice() {
function test_rc_cyclic_with_zero_refs (line 26881) | fn test_rc_cyclic_with_zero_refs() {
function test_rc_cyclic_with_one_ref (line 26899) | fn test_rc_cyclic_with_one_ref() {
function test_rc_cyclic_with_two_ref (line 26921) | fn test_rc_cyclic_with_two_ref() {
type LinkedList (line 26983) | pub struct LinkedList<T> {
type Node (line 26990) | struct Node<T> {
type Iter (line 27001) | pub struct Iter<'a, T: 'a> {
function fmt (line 27010) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method clone (line 27018) | fn clone(&self) -> Self {
type IterMut (line 27028) | pub struct IterMut<'a, T: 'a> {
function fmt (line 27040) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type IntoIter (line 27053) | pub struct IntoIter<T> {
function fmt (line 27059) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function new (line 27065) | fn new(element: T) -> Self {
function into_element (line 27069) | fn into_element(self: Box<Self>) -> T {
function push_front_node (line 27078) | fn push_front_node(&mut self, mut node: Box<Node<T>>) {
function pop_front_node (line 27099) | fn pop_front_node(&mut self) -> Option<Box<Node<T>>> {
function push_back_node (line 27119) | fn push_back_node(&mut self, mut node: Box<Node<T>>) {
function pop_back_node (line 27140) | fn pop_back_node(&mut self) -> Option<Box<Node<T>>> {
function unlink_node (line 27165) | unsafe fn unlink_node(&mut self, mut node: NonNull<Node<T>>) {
function splice_nodes (line 27188) | unsafe fn splice_nodes(
function detach_all_nodes (line 27222) | fn detach_all_nodes(mut self) -> Option<(NonNull<Node<T>>, NonNull<Node<...
function split_off_before_node (line 27235) | unsafe fn split_off_before_node(
function split_off_after_node (line 27274) | unsafe fn split_off_after_node(
method default (line 27318) | fn default() -> Self {
function new (line 27336) | pub const fn new() -> Self {
function append (line 27370) | pub fn append(&mut self, other: &mut Self) {
function prepend (line 27391) | pub fn prepend(&mut self, other: &mut Self) {
function iter (line 27431) | pub fn iter(&self) -> Iter<'_, T> {
function iter_mut (line 27460) | pub fn iter_mut(&mut self) -> IterMut<'_, T> {
function cursor_front (line 27469) | pub fn cursor_front(&self) -> Cursor<'_, T> {
function cursor_front_mut (line 27478) | pub fn cursor_front_mut(&mut self) -> CursorMut<'_, T> {
function cursor_back (line 27487) | pub fn cursor_back(&self) -> Cursor<'_, T> {
function cursor_back_mut (line 27496) | pub fn cursor_back_mut(&mut self) -> CursorMut<'_, T> {
function is_empty (line 27517) | pub fn is_empty(&self) -> bool {
function len (line 27544) | pub fn len(&self) -> usize {
function clear (line 27570) | pub fn clear(&mut self) {
function contains (line 27592) | pub fn contains(&self, x: &T) -> bool
function front (line 27615) | pub fn front(&self) -> Option<&T> {
function front_mut (line 27641) | pub fn front_mut(&mut self) -> Option<&mut T> {
function back (line 27661) | pub fn back(&self) -> Option<&T> {
function back_mut (line 27687) | pub fn back_mut(&mut self) -> Option<&mut T> {
function push_front (line 27709) | pub fn push_front(&mut self, elt: T) {
function pop_front (line 27733) | pub fn pop_front(&mut self) -> Option<T> {
function push_back (line 27752) | pub fn push_back(&mut self, elt: T) {
function pop_back (line 27773) | pub fn pop_back(&mut self) -> Option<T> {
function split_off (line 27803) | pub fn split_off(&mut self, at: usize) -> LinkedList<T> {
function remove (line 27858) | pub fn remove(&mut self, at: usize) -> T {
function drain_filter (line 27907) | pub fn drain_filter<F>(&mut self, filter: F) -> DrainFilter<'_, T, F>
method drop (line 27921) | fn drop(&mut self) {
type Item (line 27942) | type Item = &'a T;
method next (line 27945) | fn next(&mut self) -> Option<&'a T> {
method size_hint (line 27960) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 27965) | fn last(mut self) -> Option<&'a T> {
method next_back (line 27973) | fn next_back(&mut self) -> Option<&'a T> {
type Item (line 27996) | type Item = &'a mut T;
method next (line 27999) | fn next(&mut self) -> Option<&'a mut T> {
method size_hint (line 28014) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 28019) | fn last(mut self) -> Option<&'a mut T> {
method next_back (line 28027) | fn next_back(&mut self) -> Option<&'a mut T> {
type Cursor (line 28058) | pub struct Cursor<'a, T: 'a> {
method clone (line 28066) | fn clone(&self) -> Self {
function fmt (line 28074) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type CursorMut (line 28090) | pub struct CursorMut<'a, T: 'a> {
function fmt (line 28098) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function index (line 28109) | pub fn index(&self) -> Option<usize> {
function move_next (line 28120) | pub fn move_next(&mut self) {
function move_prev (line 28142) | pub fn move_prev(&mut self) {
function current (line 28163) | pub fn current(&self) -> Option<&'a T> {
function peek_next (line 28173) | pub fn peek_next(&self) -> Option<&'a T> {
function peek_prev (line 28189) | pub fn peek_prev(&self) -> Option<&'a T> {
function index (line 28206) | pub fn index(&self) -> Option<usize> {
function move_next (line 28217) | pub fn move_next(&mut self) {
function move_prev (line 28239) | pub fn move_prev(&mut self) {
function current (line 28260) | pub fn current(&mut self) -> Option<&mut T> {
function peek_next (line 28270) | pub fn peek_next(&mut self) -> Option<&mut T> {
function peek_prev (line 28286) | pub fn peek_prev(&mut self) -> Option<&mut T> {
function as_cursor (line 28302) | pub fn as_cursor(&self) -> Cursor<'_, T> {
function insert_after (line 28315) | pub fn insert_after(&mut self, item: T) {
function insert_before (line 28335) | pub fn insert_before(&mut self, item: T) {
function remove_current (line 28355) | pub fn remove_current(&mut self) -> Option<T> {
function remove_current_as_list (line 28373) | pub fn remove_current_as_list(&mut self) -> Option<LinkedList<T>> {
function splice_after (line 28395) | pub fn splice_after(&mut self, list: LinkedList<T>) {
function splice_before (line 28418) | pub fn splice_before(&mut self, list: LinkedList<T>) {
function split_after (line 28440) | pub fn split_after(&mut self) -> LinkedList<T> {
function split_before (line 28456) | pub fn split_before(&mut self) -> LinkedList<T> {
type DrainFilter (line 28465) | pub struct DrainFilter<'a, T: 'a, F: 'a>
type Item (line 28481) | type Item = T;
method next (line 28483) | fn next(&mut self) -> Option<T> {
method size_hint (line 28500) | fn size_hint(&self) -> (usize, Option<usize>) {
method drop (line 28510) | fn drop(&mut self) {
function fmt (line 28537) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Item (line 28544) | type Item = T;
method next (line 28547) | fn next(&mut self) -> Option<T> {
method size_hint (line 28552) | fn size_hint(&self) -> (usize, Option<usize>) {
method next_back (line 28560) | fn next_back(&mut self) -> Option<T> {
function from_iter (line 28573) | fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self {
type Item (line 28582) | type Item = T;
type IntoIter (line 28583) | type IntoIter = IntoIter<T>;
method into_iter (line 28587) | fn into_iter(self) -> IntoIter<T> {
type Item (line 28594) | type Item = &'a T;
type IntoIter (line 28595) | type IntoIter = Iter<'a, T>;
method into_iter (line 28597) | fn into_iter(self) -> Iter<'a, T> {
type Item (line 28604) | type Item = &'a mut T;
type IntoIter (line 28605) | type IntoIter = IterMut<'a, T>;
method into_iter (line 28607) | fn into_iter(self) -> IterMut<'a, T> {
function extend (line 28614) | fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
function extend_one (line 28619) | fn extend_one(&mut self, elem: T) {
function spec_extend (line 28625) | default fn spec_extend(&mut self, iter: I) {
function spec_extend (line 28631) | fn spec_extend(&mut self, ref mut other: LinkedList<T>) {
function extend (line 28638) | fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
function extend_one (line 28643) | fn extend_one(&mut self, &elem: &'a T) {
method eq (line 28650) | fn eq(&self, other: &Self) -> bool {
method ne (line 28654) | fn ne(&self, other: &Self) -> bool {
method partial_cmp (line 28664) | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
method cmp (line 28672) | fn cmp(&self, other: &Self) -> Ordering {
method clone (line 28679) | fn clone(&self) -> Self {
method clone_from (line 28683) | fn clone_from(&mut self, other: &Self) {
function fmt (line 28699) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method hash (line 28706) | fn hash<H: Hasher>(&self, state: &mut H) {
function assert_covariance (line 28716) | fn assert_covariance() {
function list_from (line 28764) | fn list_from<T: Clone>(v: &[T]) -> LinkedList<T> {
function check_links (line 28768) | pub fn check_links<T>(list: &LinkedList<T>) {
function test_append (line 28813) | fn test_append() {
function test_clone_from (line 28870) | fn test_clone_from() {
function test_send (line 28914) | fn test_send() {
function test_fuzz (line 28927) | fn test_fuzz() {
function test_26021 (line 28937) | fn test_26021() {
function test_split_off (line 28956) | fn test_split_off() {
function fuzz_test (line 28974) | fn fuzz_test(sz: i32) {
function drain_filter_test (line 29013) | fn drain_filter_test() {
function drain_to_empty_test (line 29025) | fn drain_to_empty_test() {
function test_cursor_move_peek (line 29037) | fn test_cursor_move_peek() {
function test_cursor_mut_insert (line 29130) | fn test_cursor_mut_insert() {
function append_from_sorted_iters (line 29203) | pub fn append_from_sorted_iters<I>(&mut self, left: I, right: I, length:...
function bulk_push (line 29218) | pub fn bulk_push<I>(&mut self, iter: I, length: &mut usize)
type MergeIter (line 29274) | struct MergeIter<K, V, I: Iterator<Item = (K, V)>>(MergeIterInner<I>);
type Item (line 29280) | type Item = (K, V);
method next (line 29283) | fn next(&mut self) -> Option<(K, V)> {
type CrashTestDummy (line 29300) | pub struct CrashTestDummy {
method new (line 29309) | pub fn new(id: usize) -> CrashTestDummy {
method spawn (line 29320) | pub fn spawn(&self, panic: Panic) -> Instance<'_> {
method cloned (line 29325) | pub fn cloned(&self) -> usize {
method dropped (line 29330) | pub fn dropped(&self) -> usize {
method queried (line 29335) | pub fn queried(&self) -> usize {
type Instance (line 29341) | pub struct Instance<'a> {
type Panic (line 29347) | pub enum Panic {
function id (line 29355) | pub fn id(&self) -> usize {
function query (line 29360) | pub fn query<R>(&self, result: R) -> R {
method clone (line 29370) | fn clone(&self) -> Self {
method drop (line 29380) | fn drop(&mut self) {
method partial_cmp (line 29389) | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
method cmp (line 29395) | fn cmp(&self, other: &Self) -> Ordering {
method eq (line 29401) | fn eq(&self, other: &Self) -> bool {
type DeterministicRng (line 29408) | pub struct DeterministicRng {
method new (line 29417) | pub fn new() -> Self {
method next (line 29422) | pub fn next(&mut self) -> u32 {
type Cyclic3 (line 29441) | pub enum Cyclic3 {
method partial_cmp (line 29449) | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
method cmp (line 29455) | fn cmp(&self, other: &Self) -> Ordering {
method eq (line 29465) | fn eq(&self, other: &Self) -> bool {
type Governor (line 29474) | pub struct Governor {
method new (line 29479) | pub fn new() -> Self {
method flip (line 29483) | pub fn flip(&self) {
type Governed (line 29492) | pub struct Governed<'a, T>(pub T, pub &'a Governor);
method partial_cmp (line 29495) | fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
method cmp (line 29501) | fn cmp(&self, other: &Self) -> Ordering {
method eq (line 29509) | fn eq(&self, other: &Self) -> bool {
type SearchBound (line 29528) | pub enum SearchBound<T> {
function from_range (line 29540) | pub fn from_range(range_bound: Bound<T>) -> Self {
type SearchResult (line 29549) | pub enum SearchResult<BorrowType, K, V, FoundType, GoDownType> {
type IndexResult (line 29554) | pub enum IndexResult {
function search_tree (line 29566) | pub fn search_tree<Q: ?Sized>(
function search_tree_for_bifurcation (line 29600) | pub fn search_tree_for_bifurcation<'r, Q: ?Sized, R>(
function find_lower_bound_edge (line 29665) | pub fn find_lower_bound_edge<'r, Q>(
function find_upper_bound_edge (line 29679) | pub fn find_upper_bound_edge<'r, Q>(
function search_node (line 29701) | pub fn search_node<Q: ?Sized>(self, key: &Q) -> SearchResult<BorrowType,...
function find_key_index (line 29720) | unsafe fn find_key_index<Q: ?Sized>(&self, key: &Q, start_index: usize) ...
function find_lower_bound_index (line 29743) | fn find_lower_bound_index<'r, Q>(
function find_upper_bound_index (line 29770) | unsafe fn find_upper_bound_index<'r, Q>(
constant MIN_LEN (line 29814) | pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
type BTreeMap (line 29935) | pub struct BTreeMap<K, V> {
method drop (line 29942) | fn drop(&mut self) {
method clone (line 29951) | fn clone(&self) -> BTreeMap<K, V> {
type Key (line 30031) | type Key = K;
function get (line 30033) | fn get(&self, key: &Q) -> Option<&K> {
function take (line 30041) | fn take(&mut self, key: &Q) -> Option<K> {
function replace (line 30052) | fn replace(&mut self, key: K) -> Option<K> {
type Iter (line 30072) | pub struct Iter<'a, K: 'a, V: 'a> {
function fmt (line 30079) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type IterMut (line 30092) | pub struct IterMut<'a, K: 'a, V: 'a> {
type IntoIter (line 30104) | pub struct IntoIter<K, V> {
function iter (line 30112) | pub(super) fn iter(&self) -> Iter<'_, K, V> {
function fmt (line 30120) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Dropper (line 30128) | struct Dropper<K, V> {
type Keys (line 30140) | pub struct Keys<'a, K: 'a, V: 'a> {
function fmt (line 30146) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Values (line 30158) | pub struct Values<'a, K: 'a, V: 'a> {
function fmt (line 30164) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type ValuesMut (line 30176) | pub struct ValuesMut<'a, K: 'a, V: 'a> {
function fmt (line 30182) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type IntoKeys (line 30194) | pub struct IntoKeys<K, V> {
function fmt (line 30200) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type IntoValues (line 30212) | pub struct IntoValues<K, V> {
function fmt (line 30218) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Range (line 30230) | pub struct Range<'a, K: 'a, V: 'a> {
function fmt (line 30236) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type RangeMut (line 30248) | pub struct RangeMut<'a, K: 'a, V: 'a> {
function fmt (line 30257) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function new (line 30282) | pub const fn new() -> BTreeMap<K, V>
function clear (line 30304) | pub fn clear(&mut self) {
function get (line 30326) | pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V>
function get_key_value (line 30354) | pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)>
function first_key_value (line 30384) | pub fn first_key_value(&self) -> Option<(&K, &V)>
function first_entry (line 30413) | pub fn first_entry(&mut self) -> Option<OccupiedEntry<'_, K, V>>
function pop_first (line 30443) | pub fn pop_first(&mut self) -> Option<(K, V)>
function last_key_value (line 30467) | pub fn last_key_value(&self) -> Option<(&K, &V)>
function last_entry (line 30496) | pub fn last_entry(&mut self) -> Option<OccupiedEntry<'_, K, V>>
function pop_last (line 30526) | pub fn pop_last(&mut self) -> Option<(K, V)>
function contains_key (line 30551) | pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool
function get_mut (line 30580) | pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V>
function insert (line 30619) | pub fn insert(&mut self, key: K, value: V) -> Option<V>
function try_insert (line 30656) | pub fn try_insert(&mut self, key: K, value: V) -> Result<&mut V, Occupie...
function remove (line 30686) | pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V>
function remove_entry (line 30713) | pub fn remove_entry<Q: ?Sized>(&mut self, key: &Q) -> Option<(K, V)>
function retain (line 30744) | pub fn retain<F>(&mut self, mut f: F)
function append (line 30781) | pub fn append(&mut self, other: &mut Self)
function range (line 30832) | pub fn range<T: ?Sized, R>(&self, range: R) -> Range<'_, K, V>
function range_mut (line 30876) | pub fn range_mut<T: ?Sized, R>(&mut self, range: R) -> RangeMut<'_, K, V>
function entry (line 30908) | pub fn entry(&mut self, key: K) -> Entry<'_, K, V>
function split_off (line 30953) | pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
function drain_filter (line 31005) | pub fn drain_filter<F>(&mut self, pred: F) -> DrainFilter<'_, K, V, F>
function drain_filter_inner (line 31013) | pub(super) fn drain_filter_inner(&mut self) -> DrainFilterInner<'_, K, V>
function into_keys (line 31049) | pub fn into_keys(self) -> IntoKeys<K, V> {
function into_values (line 31072) | pub fn into_values(self) -> IntoValues<K, V> {
type Item (line 31079) | type Item = (&'a K, &'a V);
type IntoIter (line 31080) | type IntoIter = Iter<'a, K, V>;
method into_iter (line 31082) | fn into_iter(self) -> Iter<'a, K, V> {
type Item (line 31089) | type Item = (&'a K, &'a V);
method next (line 31091) | fn next(&mut self) -> Option<(&'a K, &'a V)> {
method size_hint (line 31100) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 31104) | fn last(mut self) -> Option<(&'a K, &'a V)> {
method min (line 31108) | fn min(mut self) -> Option<(&'a K, &'a V)> {
method max (line 31112) | fn max(mut self) -> Option<(&'a K, &'a V)> {
method next_back (line 31122) | fn next_back(&mut self) -> Option<(&'a K, &'a V)> {
method len (line 31134) | fn len(&self) -> usize {
method clone (line 31141) | fn clone(&self) -> Self {
type Item (line 31148) | type Item = (&'a K, &'a mut V);
type IntoIter (line 31149) | type IntoIter = IterMut<'a, K, V>;
method into_iter (line 31151) | fn into_iter(self) -> IterMut<'a, K, V> {
type Item (line 31158) | type Item = (&'a K, &'a mut V);
method next (line 31160) | fn next(&mut self) -> Option<(&'a K, &'a mut V)> {
method size_hint (line 31169) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 31173) | fn last(mut self) -> Option<(&'a K, &'a mut V)> {
method min (line 31177) | fn min(mut self) -> Option<(&'a K, &'a mut V)> {
method max (line 31181) | fn max(mut self) -> Option<(&'a K, &'a mut V)> {
method next_back (line 31188) | fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> {
method len (line 31200) | fn len(&self) -> usize {
function iter (line 31211) | pub(super) fn iter(&self) -> Iter<'_, K, V> {
type Item (line 31218) | type Item = (K, V);
type IntoIter (line 31219) | type IntoIter = IntoIter<K, V>;
method into_iter (line 31221) | fn into_iter(self) -> IntoIter<K, V> {
method drop (line 31234) | fn drop(&mut self) {
method drop (line 31266) | fn drop(&mut self) {
type Item (line 31275) | type Item = (K, V);
method next (line 31277) | fn next(&mut self) -> Option<(K, V)> {
method size_hint (line 31286) | fn size_hint(&self) -> (usize, Option<usize>) {
method next_back (line 31293) | fn next_back(&mut self) -> Option<(K, V)> {
method len (line 31305) | fn len(&self) -> usize {
type Item (line 31315) | type Item = &'a K;
method next (line 31317) | fn next(&mut self) -> Option<&'a K> {
method size_hint (line 31321) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 31325) | fn last(mut self) -> Option<&'a K> {
method min (line 31329) | fn min(mut self) -> Option<&'a K> {
method max (line 31333) | fn max(mut self) -> Option<&'a K> {
method next_back (line 31340) | fn next_back(&mut self) -> Option<&'a K> {
method len (line 31347) | fn len(&self) -> usize {
method clone (line 31357) | fn clone(&self) -> Self {
type Item (line 31364) | type Item = &'a V;
method next (line 31366) | fn next(&mut self) -> Option<&'a V> {
method size_hint (line 31370) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 31374) | fn last(mut self) -> Option<&'a V> {
method next_back (line 31381) | fn next_back(&mut self) -> Option<&'a V> {
method len (line 31388) | fn len(&self) -> usize {
method clone (line 31398) | fn clone(&self) -> Self {
type DrainFilter (line 31405) | pub struct DrainFilter<'a, K, V, F>
type DrainFilterInner (line 31416) | pub(super) struct DrainFilterInner<'a, K: 'a, V: 'a> {
method drop (line 31433) | fn drop(&mut self) {
function fmt (line 31445) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Item (line 31455) | type Item = (K, V);
method next (line 31457) | fn next(&mut self) -> Option<(K, V)> {
method size_hint (line 31461) | fn size_hint(&self) -> (usize, Option<usize>) {
function peek (line 31468) | pub(super) fn peek(&self) -> Option<(&K, &V)> {
function next (line 31474) | pub(super) fn next<F>(&mut self, pred: &mut F) -> Option<(K, V)>
function size_hint (line 31498) | pub(super) fn size_hint(&self) -> (usize, Option<usize>) {
type Item (line 31512) | type Item = (&'a K, &'a V);
method next (line 31514) | fn next(&mut self) -> Option<(&'a K, &'a V)> {
method last (line 31518) | fn last(mut self) -> Option<(&'a K, &'a V)> {
method min (line 31522) | fn min(mut self) -> Option<(&'a K, &'a V)> {
method max (line 31526) | fn max(mut self) -> Option<(&'a K, &'a V)> {
type Item (line 31533) | type Item = &'a mut V;
method next (line 31535) | fn next(&mut self) -> Option<&'a mut V> {
method size_hint (line 31539) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 31543) | fn last(mut self) -> Option<&'a mut V> {
method next_back (line 31550) | fn next_back(&mut self) -> Option<&'a mut V> {
method len (line 31557) | fn len(&self) -> usize {
function next_unchecked (line 31566) | unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) {
type Item (line 31573) | type Item = K;
method next (line 31575) | fn next(&mut self) -> Option<K> {
method size_hint (line 31579) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 31583) | fn last(mut self) -> Option<K> {
method min (line 31587) | fn min(mut self) -> Option<K> {
method max (line 31591) | fn max(mut self) -> Option<K> {
method next_back (line 31598) | fn next_back(&mut self) -> Option<K> {
method len (line 31605) | fn len(&self) -> usize {
type Item (line 31615) | type Item = V;
method next (line 31617) | fn next(&mut self) -> Option<V> {
method size_hint (line 31621) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 31625) | fn last(mut self) -> Option<V> {
method next_back (line 31632) | fn next_back(&mut self) -> Option<V> {
method len (line 31639) | fn len(&self) -> usize {
method next_back (line 31649) | fn next_back(&mut self) -> Option<(&'a K, &'a V)> {
function next_back_unchecked (line 31655) | unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a V) {
method clone (line 31665) | fn clone(&self) -> Self {
type Item (line 31672) | type Item = (&'a K, &'a mut V);
method next (line 31674) | fn next(&mut self) -> Option<(&'a K, &'a mut V)> {
method last (line 31678) | fn last(mut self) -> Option<(&'a K, &'a mut V)> {
method min (line 31682) | fn min(mut self) -> Option<(&'a K, &'a mut V)> {
method max (line 31686) | fn max(mut self) -> Option<(&'a K, &'a mut V)> {
function next_unchecked (line 31692) | unsafe fn next_unchecked(&mut self) -> (&'a K, &'a mut V) {
function iter (line 31698) | pub(super) fn iter(&self) -> Range<'_, K, V> {
method next_back (line 31705) | fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> {
function next_back_unchecked (line 31714) | unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a mut V) {
function from_iter (line 31721) | fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> BTreeMap<K, V> {
function extend (line 31731) | fn extend<T: IntoIterator<Item = (K, V)>>(&mut self, iter: T) {
function extend_one (line 31738) | fn extend_one(&mut self, (k, v): (K, V)) {
function extend (line 31745) | fn extend<I: IntoIterator<Item = (&'a K, &'a V)>>(&mut self, iter: I) {
function extend_one (line 31750) | fn extend_one(&mut self, (&k, &v): (&'a K, &'a V)) {
method hash (line 31757) | fn hash<H: Hasher>(&self, state: &mut H) {
method default (line 31767) | fn default() -> BTreeMap<K, V> {
method eq (line 31774) | fn eq(&self, other: &BTreeMap<K, V>) -> bool {
method partial_cmp (line 31785) | fn partial_cmp(&self, other: &BTreeMap<K, V>) -> Option<Ordering> {
method cmp (line 31793) | fn cmp(&self, other: &BTreeMap<K, V>) -> Ordering {
method fmt (line 31800) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Output (line 31811) | type Output = V;
function index (line 31819) | fn index(&self, key: &Q) -> &V {
function iter (line 31847) | pub fn iter(&self) -> Iter<'_, K, V> {
function iter_mut (line 31879) | pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
function keys (line 31912) | pub fn keys(&self) -> Keys<'_, K, V> {
function values (line 31933) | pub fn values(&self) -> Values<'_, K, V> {
function values_mut (line 31959) | pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
function len (line 31980) | pub const fn len(&self) -> usize {
function is_empty (line 32000) | pub const fn is_empty(&self) -> bool {
function ensure_is_owned (line 32006) | fn ensure_is_owned(root: &mut Option<Root<K, V>>) -> &mut Root<K, V> {
type DormantMutRef (line 32026) | pub struct DormantMutRef<'a, T> {
function new (line 32038) | pub fn new(t: &'a mut T) -> (&'a mut T, Self) {
function awaken (line 32052) | pub unsafe fn awaken(self) -> &'a mut T {
function take_mut (line 32070) | pub fn take_mut<T>(v: &mut T, change: impl FnOnce(T) -> T) {
function replace (line 32079) | pub fn replace<T, R>(v: &mut T, change: impl FnOnce(T) -> (T, R)) -> R {
function calc_split_length (line 32102) | pub fn calc_split_length(
function split_off (line 32125) | pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
function new_pillar (line 32159) | fn new_pillar(height: usize) -> Self {
type BTreeSet (line 32231) | pub struct BTreeSet<T> {
method clone (line 32237) | fn clone(&self) -> Self {
method clone_from (line 32241) | fn clone_from(&mut self, other: &Self) {
type Iter (line 32253) | pub struct Iter<'a, T: 'a> {
function fmt (line 32259) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type IntoIter (line 32272) | pub struct IntoIter<T> {
type Range (line 32284) | pub struct Range<'a, T: 'a> {
type Difference (line 32295) | pub struct Difference<'a, T: 'a> {
type DifferenceInner (line 32299) | enum DifferenceInner<'a, T: 'a> {
function fmt (line 32315) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type SymmetricDifference (line 32327) | pub struct SymmetricDifference<'a, T: 'a>(MergeIterInner<Iter<'a, T>>);
function fmt (line 32331) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Intersection (line 32343) | pub struct Intersection<'a, T: 'a> {
type IntersectionInner (line 32347) | enum IntersectionInner<'a, T: 'a> {
function fmt (line 32363) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Union (line 32375) | pub struct Union<'a, T: 'a>(MergeIterInner<Iter<'a, T>>);
function fmt (line 32379) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
constant ITER_PERFORMANCE_TIPPING_SIZE_DIFF (line 32390) | const ITER_PERFORMANCE_TIPPING_SIZE_DIFF: usize = 16;
function new (line 32407) | pub const fn new() -> BTreeSet<T>
function range (line 32437) | pub fn range<K: ?Sized, R>(&self, range: R) -> Range<'_, T>
function difference (line 32467) | pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Difference<'a...
function symmetric_difference (line 32528) | pub fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Sym...
function intersection (line 32556) | pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T>) -> Intersectio...
function union (line 32607) | pub fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> Union<'a, T>
function clear (line 32627) | pub fn clear(&mut self) {
function contains (line 32647) | pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool
function get (line 32671) | pub fn get<Q: ?Sized>(&self, value: &Q) -> Option<&T>
function is_disjoint (line 32697) | pub fn is_disjoint(&self, other: &BTreeSet<T>) -> bool
function is_subset (line 32722) | pub fn is_subset(&self, other: &BTreeSet<T>) -> bool
function is_superset (line 32801) | pub fn is_superset(&self, other: &BTreeSet<T>) -> bool
function first (line 32827) | pub fn first(&self) -> Option<&T>
function last (line 32853) | pub fn last(&self) -> Option<&T>
function pop_first (line 32878) | pub fn pop_first(&mut self) -> Option<T>
function pop_last (line 32903) | pub fn pop_last(&mut self) -> Option<T>
function insert (line 32931) | pub fn insert(&mut self, value: T) -> bool
function replace (line 32954) | pub fn replace(&mut self, value: T) -> Option<T>
function remove (line 32981) | pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool
function take (line 33005) | pub fn take<Q: ?Sized>(&mut self, value: &Q) -> Option<T>
function retain (line 33029) | pub fn retain<F>(&mut self, mut f: F)
function append (line 33066) | pub fn append(&mut self, other: &mut Self)
function split_off (line 33103) | pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self
function drain_filter (line 33138) | pub fn drain_filter<'a, F>(&'a mut self, pred: F) -> DrainFilter<'a, T, F>
function iter (line 33174) | pub fn iter(&self) -> Iter<'_, T> {
function len (line 33193) | pub const fn len(&self) -> usize {
function is_empty (line 33211) | pub const fn is_empty(&self) -> bool {
function from_iter (line 33218) | fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> BTreeSet<T> {
type Item (line 33227) | type Item = T;
type IntoIter (line 33228) | type IntoIter = IntoIter<T>;
method into_iter (line 33242) | fn into_iter(self) -> IntoIter<T> {
type Item (line 33249) | type Item = &'a T;
type IntoIter (line 33250) | type IntoIter = Iter<'a, T>;
method into_iter (line 33252) | fn into_iter(self) -> Iter<'a, T> {
type DrainFilter (line 33259) | pub struct DrainFilter<'a, T, F>
method drop (line 33273) | fn drop(&mut self) {
function fmt (line 33284) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Item (line 33294) | type Item = T;
method next (line 33296) | fn next(&mut self) -> Option<T> {
method size_hint (line 33302) | fn size_hint(&self) -> (usize, Option<usize>) {
function extend (line 33313) | fn extend<Iter: IntoIterator<Item = T>>(&mut self, iter: Iter) {
function extend_one (line 33320) | fn extend_one(&mut self, elem: T) {
function extend (line 33327) | fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
function extend_one (line 33332) | fn extend_one(&mut self, &elem: &'a T) {
method default (line 33340) | fn default() -> BTreeSet<T> {
type Output (line 33347) | type Output = BTreeSet<T>;
function sub (line 33363) | fn sub(self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
type Output (line 33370) | type Output = BTreeSet<T>;
function bitxor (line 33386) | fn bitxor(self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
type Output (line 33393) | type Output = BTreeSet<T>;
function bitand (line 33409) | fn bitand(self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
type Output (line 33416) | type Output = BTreeSet<T>;
function bitor (line 33432) | fn bitor(self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
method fmt (line 33439) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method clone (line 33446) | fn clone(&self) -> Self {
type Item (line 33452) | type Item = &'a T;
method next (line 33454) | fn next(&mut self) -> Option<&'a T> {
method size_hint (line 33458) | fn size_hint(&self) -> (usize, Option<usize>) {
method last (line 33462) | fn last(mut self) -> Option<&'a T> {
method min (line 33466) | fn min(mut self) -> Option<&'a T> {
method max (line 33470) | fn max(mut self) -> Option<&'a T> {
method next_back (line 33476) | fn next_back(&mut self) -> Option<&'a T> {
method len (line 33482) | fn len(&self) -> usize {
type Item (line 33492) | type Item = T;
method next (line 33494) | fn next(&mut self) -> Option<T> {
method size_hint (line 33498) | fn size_hint(&self) -> (usize, Option<usize>) {
method next_back (line 33504) | fn next_back(&mut self) -> Option<T> {
method len (line 33510) | fn len(&self) -> usize {
method clone (line 33520) | fn clone(&self) -> Self {
type Item (line 33527) | type Item = &'a T;
method next (line 33529) | fn next(&mut self) -> Option<&'a T> {
method last (line 33533) | fn last(mut self) -> Option<&'a T> {
method min (line 33537) | fn min(mut self) -> Option<&'a T> {
method max (line 33541) | fn max(mut self) -> Option<&'a T> {
method next_back (line 33548) | fn next_back(&mut self) -> Option<&'a T> {
method clone (line 33558) | fn clone(&self) -> Self {
type Item (line 33575) | type Item = &'a T;
method next (line 33577) | fn next(&mut self) -> Option<&'a T> {
method size_hint (line 33604) | fn size_hint(&self) -> (usize, Option<usize>) {
method min (line 33615) | fn min(mut self) -> Option<&'a T> {
method clone (line 33625) | fn clone(&self) -> Self {
type Item (line 33631) | type Item = &'a T;
method next (line 33633) | fn next(&mut self) -> Option<&'a T> {
method size_hint (line 33642) | fn size_hint(&self) -> (usize, Option<usize>) {
method min (line 33650) | fn min(mut self) -> Option<&'a T> {
method clone (line 33660) | fn clone(&self) -> Self {
type Item (line 33676) | type Item = &'a T;
method next (line 33678) | fn next(&mut self) -> Option<&'a T> {
method size_hint (line 33701) | fn size_hint(&self) -> (usize, Option<usize>) {
method min (line 33710) | fn min(mut self) -> Option<&'a T> {
method clone (line 33720) | fn clone(&self) -> Self {
type Item (line 33726) | type Item = &'a T;
method next (line 33728) | fn next(&mut self) -> Option<&'a T> {
method size_hint (line 33733) | fn size_hint(&self) -> (usize, Option<usize>) {
method min (line 33739) | fn min(mut self) -> Option<&'a T> {
type LeafRange (line 33755) | pub struct LeafRange<BorrowType, K, V> {
function none (line 33761) | pub fn none() -> Self {
function is_empty (line 33765) | pub fn is_empty(&self) -> bool {
function reborrow (line 33770) | pub fn reborrow(&self) -> LeafRange<marker::Immut<'_>, K, V> {
function find_leaf_edges_spanning_range (line 33792) | unsafe fn find_leaf_edges_spanning_range<Q: ?Sized, R>(
function full_range (line 33830) | fn full_range<BorrowType: marker::BorrowType, K, V>(
function range_search (line 33857) | pub fn range_search<Q, R>(self, range: R) -> LeafRange<marker::Immut<'a>...
function full_range (line 33868) | pub fn full_range(self) -> LeafRange<marker::Immut<'a>, K, V> {
function range_search (line 33883) | pub fn range_search<Q, R>(self, range: R) -> LeafRange<marker::ValMut<'a...
function full_range (line 33895) | pub fn full_range(self) -> LeafRange<marker::ValMut<'a>, K, V> {
function full_range (line 33907) | pub fn full_range(self) -> LeafRange<marker::Dying, K, V> {
function next_kv (line 33921) | pub fn next_kv(
function next_back_kv (line 33942) | pub fn next_back_kv(
function next_kv (line 33967) | pub fn next_kv(
function deallocating_next (line 33998) | unsafe fn deallocating_next(self) -> Option<(Self, (K, V))> {
function deallocating_next_back (line 34026) | unsafe fn deallocating_next_back(self) -> Option<(Self, (K, V))> {
function deallocating_end (line 34049) | pub fn deallocating_end(self) {
function next_unchecked (line 34063) | pub unsafe fn next_unchecked(&mut self) -> (&'a K, &'a V) {
function next_back_unchecked (line 34076) | pub unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a V) {
function next_unchecked (line 34091) | pub unsafe fn next_unchecked(&mut self) -> (&'a K, &'a mut V) {
function next_back_unchecked (line 34106) | pub unsafe fn next_back_unchecked(&mut self) -> (&'a K, &'a mut V) {
function deallocating_next_unchecked (line 34130) | pub unsafe fn deallocating_next_unchecked(&mut self) -> (K, V) {
function deallocating_next_back_unchecked (line 34148) | pub unsafe fn deallocating_next_back_unchecked(&mut self) -> (K, V) {
function first_leaf_edge (line 34159) | pub fn first_leaf_edge(self) -> Handle<NodeRef<BorrowType, K, V, marker:...
function last_leaf_edge (line 34172) | pub fn last_leaf_edge(self) -> Handle<NodeRef<BorrowType, K, V, marker::...
type Position (line 34183) | pub enum Position<BorrowType, K, V> {
function visit_nodes_in_order (line 34193) | pub fn visit_nodes_in_order<F>(self, mut visit: F)
function calc_length (line 34225) | pub fn calc_length(self) -> usize {
function next_leaf_edge (line 34240) | pub fn next_leaf_edge(self) -> Handle<NodeRef<BorrowType, K, V, marker::...
function next_back_leaf_edge (line 34251) | pub fn next_back_leaf_edge(
type Recover (line 34277) | trait Recover<Q: ?Sized> {
method get (line 34280) | fn get(&self, key: &Q) -> Option<&Self::Key>;
method take (line 34281) | fn take(&mut self, key: &Q) -> Option<Self::Key>;
method replace (line 34282) | fn replace(&mut self, key: Self::Key) -> Option<Self::Key>;
function test_clone_eq (line 34296) | fn test_clone_eq() {
function test_const (line 34306) | fn test_const() {
function test_iter_min_max (line 34313) | fn test_iter_min_max() {
function check (line 34343) | fn check<F>(a: &[i32], b: &[i32], expected: &[i32], f: F)
function test_intersection (line 34369) | fn test_intersection() {
function test_intersection_size_hint (line 34401) | fn test_intersection_size_hint() {
function test_difference (line 34417) | fn test_difference() {
function test_difference_size_hint (line 34453) | fn test_difference_size_hint() {
function test_symmetric_difference (line 34517) | fn test_symmetric_difference() {
function test_symmetric_difference_size_hint (line 34529) | fn test_symmetric_difference_size_hint() {
function test_union (line 34541) | fn test_union() {
function test_union_size_hint (line 34557) | fn test_union_size_hint() {
function test_is_disjoint (line 34570) | fn test_is_disjoint() {
function test_is_subset (line 34578) | fn test_is_subset() {
function test_retain (line 34615) | fn test_retain() {
function test_drain_filter (line 34626) | fn test_drain_filter() {
function test_drain_filter_drop_panic_leak (line 34637) | fn test_drain_filter_drop_panic_leak() {
function test_drain_filter_pred_panic_leak (line 34657) | fn test_drain_filter_pred_panic_leak() {
function test_clear (line 34680) | fn test_clear() {
function test_zip (line 34689) | fn test_zip() {
function test_from_iter (line 34709) | fn test_from_iter() {
function test_show (line 34720) | fn test_show() {
function test_extend_ref (line 34734) | fn test_extend_ref() {
function test_recovery (line 34762) | fn test_recovery() {
function test_variance (line 34809) | fn test_variance() {
function test_sync (line 34826) | fn test_sync() {
function test_send (line 34865) | fn test_send() {
function test_ord_absence (line 34904) | fn test_ord_absence() {
function test_append (line 34925) | fn test_append() {
function test_first_last (line 34949) | fn test_first_last() {
function rand_data (line 34984) | fn rand_data(len: usize) -> Vec<u32> {
function test_split_off_empty_right (line 34990) | fn test_split_off_empty_right() {
function test_split_off_empty_left (line 35002) | fn test_split_off_empty_left() {
function test_split_off_large_random_sorted (line 35014) | fn test_split_off_large_random_sorted() {
function test_borrow (line 35030) | fn test_borrow() {
type Entry (line 35062) | pub enum Entry<'a, K: 'a, V: 'a> {
method fmt (line 35074) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type VacantEntry (line 35085) | pub struct VacantEntry<'a, K: 'a, V: 'a> {
method fmt (line 35096) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type OccupiedEntry (line 35104) | pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
method fmt (line 35114) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type OccupiedError (line 35123) | pub struct OccupiedError<'a, K: 'a, V: 'a> {
method fmt (line 35132) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function fmt (line 35143) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function or_insert (line 35169) | pub fn or_insert(self, default: V) -> &'a mut V {
function or_insert_with (line 35192) | pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
function or_insert_with_key (line 35219) | pub fn or_insert_with_key<F: FnOnce(&K) -> V>(self, default: F) -> &'a m...
function key (line 35240) | pub fn key(&self) -> &K {
function and_modify (line 35268) | pub fn and_modify<F>(self, f: F) -> Self
function or_default (line 35297) | pub fn or_default(self) -> &'a mut V {
function key (line 35318) | pub fn key(&self) -> &K {
function into_key (line 35337) | pub fn into_key(self) -> K {
function insert (line 35358) | pub fn insert(self, value: V) -> &'a mut V {
function key (line 35395) | pub fn key(&self) -> &K {
function remove_entry (line 35419) | pub fn remove_entry(self) -> (K, V) {
function get (line 35439) | pub fn get(&self) -> &V {
function get_mut (line 35470) | pub fn get_mut(&mut self) -> &mut V {
function into_mut (line 35496) | pub fn into_mut(self) -> &'a mut V {
function insert (line 35518) | pub fn insert(&mut self, value: V) -> V {
function remove (line 35540) | pub fn remove(self) -> V {
function remove_kv (line 35545) | pub(super) fn remove_kv(self) -> (K, V) {
constant NODE_CAPACITY (line 35579) | const NODE_CAPACITY: usize = node::CAPACITY;
constant MIN_INSERTS_HEIGHT_1 (line 35584) | const MIN_INSERTS_HEIGHT_1: usize = NODE_CAPACITY + 1;
constant MIN_INSERTS_HEIGHT_2 (line 35589) | const MIN_INSERTS_HEIGHT_2: usize = 89;
function test_all_refs (line 35593) | fn test_all_refs<'a, T: 'a>(dummy: &mut T, iter: impl Iterator<Item = &'...
function check_invariants (line 35607) | fn check_invariants(&self) {
function check (line 35633) | fn check(&self)
function height (line 35642) | fn height(&self) -> Option<usize> {
function dump_keys (line 35646) | fn dump_keys(&self) -> String
function assert_strictly_ascending (line 35658) | fn assert_strictly_ascending(&self)
function compact (line 35674) | fn compact(&mut self)
function assert_min_len (line 35685) | fn assert_min_len(self, min_len: usize) {
function test_levels (line 35700) | fn test_levels() {
function test_check_ord_chaos (line 35738) | fn test_check_ord_chaos() {
function test_check_invariants_ord_chaos (line 35747) | fn test_check_invariants_ord_chaos() {
function test_basic_large (line 35755) | fn test_basic_large() {
function test_basic_small (line 35808) | fn test_basic_small() {
function test_iter (line 35894) | fn test_iter() {
function test_iter_rev (line 35917) | fn test_iter_rev() {
function do_test_iter_mut_mutation (line 35940) | fn do_test_iter_mut_mutation<T>(size: usize)
type Align32 (line 35976) | struct Align32(usize);
type Error (line 35979) | type Error = ();
method try_from (line 35981) | fn try_from(s: usize) -> Result<Align32, ()> {
function test_iter_mut_mutation (line 35987) | fn test_iter_mut_mutation() {
function test_values_mut (line 36011) | fn test_values_mut() {
function test_values_mut_mutation (line 36018) | fn test_values_mut_mutation() {
function test_iter_entering_root_twice (line 36033) | fn test_iter_entering_root_twice() {
function test_iter_descending_to_same_node_twice (line 36050) | fn test_iter_descending_to_same_node_twice() {
function test_iter_mixed (line 36065) | fn test_iter_mixed() {
function test_iter_min_max (line 36093) | fn test_iter_min_max() {
function range_keys (line 36128) | fn range_keys(map: &BTreeMap<i32, i32>, range: impl RangeBounds<i32>) ->...
function test_range_small (line 36138) | fn test_range_small() {
function test_range_height_1 (line 36197) | fn test_range_height_1() {
function test_range_large (line 36217) | fn test_range_large() {
function test_range_inclusive_max_value (line 36286) | fn test_range_inclusive_max_value() {
function test_range_equal_empty_cases (line 36294) | fn test_range_equal_empty_cases() {
function test_range_equal_excluded (line 36302) | fn test_range_equal_excluded() {
function test_range_backwards_1 (line 36309) | fn test_range_backwards_1() {
function test_range_backwards_2 (line 36316) | fn test_range_backwards_2() {
function test_range_backwards_3 (line 36323) | fn test_range_backwards_3() {
function test_range_backwards_4 (line 36330) | fn test_range_backwards_4() {
function test_range_finding_ill_order_in_map (line 36336) | fn test_range_finding_ill_order_in_map() {
function test_range_finding_ill_order_in_range_ord (line 36348) | fn test_range_finding_ill_order_in_range_ord() {
function test_range_1000 (line 36388) | fn test_range_1000() {
function test_range_borrowed_key (line 36412) | fn test_range_borrowed_key() {
function test_range (line 36426) | fn test_range() {
function test_range_mut (line 36447) | fn test_range_mut() {
function test_retain (line 36469) | fn test_retain() {
function empty (line 36483) | fn empty() {
function consumed_keeping_all (line 36492) | fn consumed_keeping_all() {
function consumed_removing_all (line 36501) | fn consumed_removing_all() {
function mutating_and_keeping (line 36511) | fn mutating_and_keeping() {
function mutating_and_removing (line 36528) | fn mutating_and_removing() {
function underfull_keeping_all (line 36543) | fn underfull_keeping_all() {
function underfull_removing_one (line 36552) | fn underfull_removing_one() {
function underfull_keeping_one (line 36563) | fn underfull_keeping_one() {
function underfull_removing_all (line 36574) | fn underfull_removing_all() {
function height_0_keeping_all (line 36583) | fn height_0_keeping_all() {
function height_0_removing_one (line 36592) | fn height_0_removing_one() {
function height_0_keeping_one (line 36603) | fn height_0_keeping_one() {
function height_0_removing_all (line 36614) | fn height_0_removing_all() {
function height_0_keeping_half (line 36623) | fn height_0_keeping_half() {
function height_1_removing_all (line 36631) | fn height_1_removing_all() {
function height_1_removing_one (line 36640) | fn height_1_removing_one() {
function height_1_keeping_one (line 36651) | fn height_1_keeping_one() {
function height_2_removing_one (line 36662) | fn height_2_removing_one() {
function height_2_keeping_one (line 36673) | fn height_2_keeping_one() {
function height_2_removing_all (line 36684) | fn height_2_removing_all() {
function drop_panic_leak (line 36693) | fn drop_panic_leak() {
function pred_panic_leak (line 36713) | fn pred_panic_leak() {
function pred_panic_reuse (line 36739) | fn pred_panic_reuse() {
function test_borrow (line 36771) | fn test_borrow() {
function test_entry (line 36844) | fn test_entry() {
function test_extend_ref (line 36896) | fn test_extend_ref() {
function test_zst (line 36913) | fn test_zst() {
function test_bad_zst (line 36940) | fn test_bad_zst() {
function test_clear (line 36973) | fn test_clear() {
function test_clear_drop_panic_leak (line 36987) | fn test_clear_drop_panic_leak() {
function test_clone (line 37010) | fn test_clone() {
function test_clone_panic_leak (line 37055) | fn test_clone_panic_leak() {
function test_clone_from (line 37084) | fn test_clone_from() {
function test_variance (line 37109) | fn test_variance() {
function test_sync (line 37168) | fn test_sync() {
function test_send (line 37237) | fn test_send() {
function test_ord_absence (line 37306) | fn test_ord_absence() {
function test_const (line 37347) | fn test_const() {
function test_occupied_entry_key (line 37354) | fn test_occupied_entry_key() {
function test_vacant_entry_key (line 37373) | fn test_vacant_entry_key() {
function test_first_last_entry (line 37392) | fn test_first_last_entry() {
function test_insert_into_full_height_0 (line 37417) | fn test_insert_into_full_height_0() {
function test_insert_into_full_height_1 (line 37427) | fn test_insert_into_full_height_1() {
function test_append_drop_leak (line 37499) | fn test_append_drop_leak() {
function test_append_ord_chaos (line 37518) | fn test_append_ord_chaos() {
function rand_data (line 37538) | fn rand_data(len: usize) -> Vec<(u32, u32)> {
function test_split_off_empty_right (line 37544) | fn test_split_off_empty_right() {
function test_split_off_empty_left (line 37558) | fn test_split_off_empty_left() {
function test_split_off_tiny_left_height_2 (line 37574) | fn test_split_off_tiny_left_height_2() {
function test_split_off_tiny_right_height_2 (line 37589) | fn test_split_off_tiny_right_height_2() {
function test_split_off_halfway (line 37604) | fn test_split_off_halfway() {
function test_split_off_large_random_sorted (line 37623) | fn test_split_off_large_random_sorted() {
function test_into_iter_drop_leak_height_0 (line 37640) | fn test_into_iter_drop_leak_height_0() {
function test_into_iter_drop_leak_height_1 (line 37663) | fn test_into_iter_drop_leak_height_1() {
function test_into_keys (line 37681) | fn test_into_keys() {
function test_into_values (line 37693) | fn test_into_values() {
function test_insert_remove_intertwined (line 37705) | fn test_insert_remove_intertwined() {
function test_insert_remove_intertwined_ord_chaos (line 37719) | fn test_insert_remove_intertwined_ord_chaos() {
function remove_kv_tracking (line 37741) | pub fn remove_kv_tracking<F: FnOnce()>(
function remove_leaf_kv (line 37753) | fn remove_leaf_kv<F: FnOnce()>(
function remove_internal_kv (line 37805) | fn remove_internal_kv<F: FnOnce()>(
type MergeIterInner (line 37830) | pub struct MergeIterInner<I: Iterator> {
type Peeked (line 37839) | enum Peeked<I: Iterator> {
method clone (line 37849) | fn clone(&self) -> Self {
method fmt (line 37859) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function new (line 37866) | pub fn new(a: I, b: I) -> Self {
function nexts (line 37877) | pub fn nexts<Cmp: Fn(&I::Item, &I::Item) -> Ordering>(
function lens (line 37911) | pub fn lens(&self) -> (usize, usize)
constant B (line 37963) | const B: usize = 6;
method fmt (line 12982) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
constant CAPACITY (line 37964) | pub const CAPACITY: usize = 2 * B - 1;
constant MIN_LEN_AFTER_SPLIT (line 37965) | pub const MIN_LEN_AFTER_SPLIT: usize = B - 1;
constant KV_IDX_CENTER (line 37966) | const KV_IDX_CENTER: usize = B - 1;
constant EDGE_IDX_LEFT_OF_CENTER (line 37967) | const EDGE_IDX_LEFT_OF_CENTER: usize = B - 1;
constant EDGE_IDX_RIGHT_OF_CENTER (line 37968) | const EDGE_IDX_RIGHT_OF_CENTER: usize = B;
type LeafNode (line 37971) | struct LeafNode<K, V> {
function init (line 37991) | unsafe fn init(this: *mut Self) {
function new (line 38002) | fn new() -> Box<Self> {
type InternalNode (line 38018) | struct InternalNode<K, V> {
function new (line 38034) | unsafe fn new() -> Box<Self> {
type BoxedNode (line 38050) | type BoxedNode<K, V> = NonNull<LeafNode<K, V>>;
type NodeRef (line 38103) | pub struct NodeRef<BorrowType, K, V, Type> {
type Root (line 38119) | pub type Root<K, V> = NodeRef<marker::Owned, K, V, marker::LeafOrInternal>;
method clone (line 38123) | fn clone(&self) -> Self {
function new_leaf (line 38137) | fn new_leaf() -> Self {
function from_new_leaf (line 38141) | fn from_new_leaf(leaf: Box<LeafNode<K, V>>) -> Self {
function new_internal (line 38147) | fn new_internal(child: Root<K, V>) -> Self {
function from_new_internal (line 38155) | unsafe fn from_new_internal(internal: Box<InternalNode<K, V>>, height: u...
function from_internal (line 38166) | fn from_internal(node: NonNull<InternalNode<K, V>>, height: usize) -> Se...
function as_internal_ptr (line 38176) | fn as_internal_ptr(this: &Self) -> *mut InternalNode<K, V> {
function as_internal_mut (line 38184) | fn as_internal_mut(&mut self) -> &mut InternalNode<K, V> {
function len (line 38195) | pub fn len(&self) -> usize {
function height (line 38206) | pub fn height(&self) -> usize {
function reborrow (line 38211) | pub fn reborrow(&self) -> NodeRef<marker::Immut<'_>, K, V, Type> {
function as_leaf_ptr (line 38218) | fn as_leaf_ptr(this: &Self) -> *mut LeafNode<K, V> {
function ascend (line 38236) | pub fn ascend(
function first_edge (line 38253) | pub fn first_edge(self) -> Handle<Self, marker::Edge> {
function last_edge (line 38257) | pub fn last_edge(self) -> Handle<Self, marker::Edge> {
function first_kv (line 38263) | pub fn first_kv(self) -> Handle<Self, marker::KV> {
function last_kv (line 38270) | pub fn last_kv(self) -> Handle<Self, marker::KV> {
function eq (line 38279) | fn eq(&self, other: &Self) -> bool {
function into_leaf (line 38292) | fn into_leaf(self) -> &'a LeafNode<K, V> {
function keys (line 38299) | pub fn keys(&self) -> &[K] {
function deallocate_and_ascend (line 38311) | pub unsafe fn deallocate_and_ascend(
function reborrow_mut (line 38342) | unsafe fn reborrow_mut(&mut self) -> NodeRef<marker::Mut<'_>, K, V, Type> {
function as_leaf_mut (line 38347) | fn as_leaf_mut(&mut self) -> &mut LeafNode<K, V> {
function into_leaf_mut (line 38354) | fn into_leaf_mut(mut self) -> &'a mut LeafNode<K, V> {
function key_area_mut (line 38366) | unsafe fn key_area_mut<I, Output: ?Sized>(&mut self, index: I) -> &mut O...
function val_area_mut (line 38380) | unsafe fn val_area_mut<I, Output: ?Sized>(&mut self, index: I) -> &mut O...
function edge_area_mut (line 38396) | unsafe fn edge_area_mut<I, Output: ?Sized>(&mut self, index: I) -> &mut ...
function into_key_val_mut_at (line 38410) | unsafe fn into_key_val_mut_at(mut self, idx: usize) -> (&'a K, &'a mut V) {
function len_mut (line 38428) | pub fn len_mut(&mut self) -> &mut u16 {
function correct_childrens_parent_links (line 38436) | unsafe fn correct_childrens_parent_links<R: Iterator<Item = usize>>(&mut...
function correct_all_childrens_parent_links (line 38443) | fn correct_all_childrens_parent_links(&mut self) {
function set_parent_link (line 38452) | fn set_parent_link(&mut self, parent: NonNull<InternalNode<K, V>>, paren...
function clear_parent_link (line 38461) | fn clear_parent_link(&mut self) {
function new (line 38470) | pub fn new() -> Self {
function push_internal_level (line 38477) | pub fn push_internal_level(&mut self) -> NodeRef<marker::Mut<'_>, K, V, ...
function pop_internal_level (line 38493) | pub fn pop_internal_level(&mut self) {
function borrow_mut (line 38517) | pub fn borrow_mut(&mut self) -> NodeRef<marker::Mut<'_>, K, V, Type> {
function borrow_valmut (line 38522) | pub fn borrow_valmut(&mut self) -> NodeRef<marker::ValMut<'_>, K, V, Typ...
function into_dying (line 38528) | pub fn into_dying(self) -> NodeRef<marker::Dying, K, V, Type> {
function push (line 38535) | pub fn push(&mut self, key: K, val: V) {
function push (line 38550) | pub fn push(&mut self, key: K, val: V, edge: Root<K, V>) {
function forget_type (line 38568) | pub fn forget_type(self) -> NodeRef<BorrowType, K, V, marker::LeafOrInte...
function forget_type (line 38575) | pub fn forget_type(self) -> NodeRef<BorrowType, K, V, marker::LeafOrInte...
function force (line 38582) | pub fn force(
function cast_to_leaf_unchecked (line 38606) | unsafe fn cast_to_leaf_unchecked(self) -> NodeRef<marker::Mut<'a>, K, V,...
function cast_to_internal_unchecked (line 38612) | unsafe fn cast_to_internal_unchecked(self) -> NodeRef<marker::Mut<'a>, K...
type Handle (line 38626) | pub struct Handle<Node, Type> {
method clone (line 38636) | fn clone(&self) -> Self {
function into_node (line 38643) | pub fn into_node(self) -> Node {
function idx (line 38648) | pub fn idx(&self) -> usize {
function new_kv (line 38656) | pub unsafe fn new_kv(node: NodeRef<BorrowType, K, V, NodeType>, idx: usi...
function left_edge (line 38662) | pub fn left_edge(self) -> Handle<NodeRef<BorrowType, K, V, NodeType>, ma...
function right_edge (line 38666) | pub fn right_edge(self) -> Handle<NodeRef<BorrowType, K, V, NodeType>, m...
method eq (line 38674) | fn eq(&self, other: &Self) -> bool {
function reborrow (line 38684) | pub fn reborrow(&self) -> Handle<NodeRef<marker::Immut<'_>, K, V, NodeTy...
function reborrow_mut (line 38696) | pub unsafe fn reborrow_mut(
function new_edge (line 38707) | pub unsafe fn new_edge(node: NodeRef<BorrowType, K, V, NodeType>, idx: u...
function left_kv (line 38713) | pub fn left_kv(self) -> Result<Handle<NodeRef<BorrowType, K, V, NodeType...
function right_kv (line 38721) | pub fn right_kv(self) -> Result<Handle<NodeRef<BorrowType, K, V, NodeTyp...
type LeftOrRight (line 38730) | pub enum LeftOrRight<T> {
function splitpoint (line 38740) | fn splitpoint(edge_idx: usize) -> (usize, LeftOrRight<usize>) {
function insert_fit (line 38757) | fn insert_fit(&mut self, key: K, val: V) -> *mut V {
function insert (line 38776) | fn insert(mut self, key: K, val: V) -> (InsertResult<'a, K, V, marker::L...
function correct_parent_link (line 38802) | fn correct_parent_link(self) {
function insert_fit (line 38815) | fn insert_fit(&mut self, key: K, val: V, edge: Root<K, V>) {
function insert (line 38833) | fn insert(
function insert_recursing (line 38871) | pub fn insert_recursing(
function descend (line 38908) | pub fn descend(self) -> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
function into_kv (line 38924) | pub fn into_kv(self) -> (&'a K, &'a V) {
function key_mut (line 38934) | pub fn key_mut(&mut self) -> &mut K {
function into_val_mut (line 38938) | pub fn into_val_mut(self) -> &'a mut V {
function into_kv_valmut (line 38946) | pub fn into_kv_valmut(self) -> (&'a K, &'a mut V) {
function kv_mut (line 38952) | pub fn kv_mut(&mut self) -> (&mut K, &mut V) {
function replace_kv (line 38965) | pub fn replace_kv(&mut self, k: K, v: V) -> (K, V) {
function split_leaf_data (line 38974) | fn split_leaf_data(&mut self, new_node: &mut LeafNode<K, V>) -> (K, V) {
function split (line 39006) | pub fn split(mut self) -> SplitResult<'a, K, V, marker::Leaf> {
function remove (line 39017) | pub fn remove(
function split (line 39038) | pub fn split(mut self) -> SplitResult<'a, K, V, marker::Internal> {
type BalancingContext (line 39059) | pub struct BalancingContext<'a, K, V> {
function consider_for_balancing (line 39066) | pub fn consider_for_balancing(self) -> BalancingContext<'a, K, V> {
function choose_parent_kv (line 39092) | pub fn choose_parent_kv(self) -> Result<LeftOrRight<BalancingContext<'a,...
function left_child_len (line 39115) | pub fn left_child_len(&self) -> usize {
function right_child_len (line 39119) | pub fn right_child_len(&self) -> usize {
function into_left_child (line 39123) | pub fn into_left_child(self) -> NodeRef<marker::Mut<'a>, K, V, marker::L...
function into_right_child (line 39127) | pub fn into_right_child(self) -> NodeRef<marker::Mut<'a>, K, V, marker::...
function can_merge (line 39133) | pub fn can_merge(&self) -> bool {
function do_merge (line 39140) | fn do_merge<
function merge_tracking_parent (line 39205) | pub fn merge_tracking_parent(self) -> NodeRef<marker::Mut<'a>, K, V, mar...
function merge_tracking_child (line 39213) | pub fn merge_tracking_child(self) -> NodeRef<marker::Mut<'a>, K, V, mark...
function merge_tracking_child_edge (line 39222) | pub fn merge_tracking_child_edge(
function steal_left (line 39244) | pub fn steal_left(
function steal_right (line 39256) | pub fn steal_right(
function bulk_steal_left (line 39265) | pub fn bulk_steal_left(&mut self, count: usize) {
function bulk_steal_right (line 39328) | pub fn bulk_steal_right(&mut self, count: usize) {
function forget_node_type (line 39393) | pub fn forget_node_type(
function forget_node_type (line 39401) | pub fn forget_node_type(
function forget_node_type (line 39409) | pub fn forget_node_type(
function forget_node_type (line 39417) | pub fn forget_node_type(
function force (line 39426) | pub fn force(
function cast_to_leaf_unchecked (line 39445) | pub unsafe fn cast_to_leaf_unchecked(
function move_suffix (line 39456) | pub fn move_suffix(
type ForceResult (line 39499) | pub enum ForceResult<Leaf, Internal> {
type SplitResult (line 39505) | pub struct SplitResult<'a, K, V, NodeType> {
function forget_node_type (line 39515) | pub fn forget_node_type(self) -> SplitResult<'a, K, V, marker::LeafOrInt...
function forget_node_type (line 39521) | pub fn forget_node_type(self) -> SplitResult<'a, K, V, marker::LeafOrInt...
type InsertResult (line 39526) | pub enum InsertResult<'a, K, V, NodeType> {
type Leaf (line 39534) | pub enum Leaf {}
type Internal (line 39535) | pub enum Internal {}
type LeafOrInternal (line 39536) | pub enum LeafOrInternal {}
type Owned (line 39538) | pub enum Owned {}
type Dying (line 39539) | pub enum Dying {}
type Immut (line 39540) | pub struct Immut<'a>(PhantomData<&'a ()>);
type Mut (line 39541) | pub struct Mut<'a>(PhantomData<&'a mut ()>);
type ValMut (line 39542) | pub struct ValMut<'a>(PhantomData<&'a mut ()>);
type BorrowType (line 39544) | pub trait BorrowType {
constant PERMITS_TRAVERSAL (line 39547) | const PERMITS_TRAVERSAL: bool = true;
constant PERMITS_TRAVERSAL (line 39553) | const PERMITS_TRAVERSAL: bool = false;
type KV (line 39560) | pub enum KV {}
type Edge (line 39561) | pub enum Edge {}
function slice_insert (line 39568) | unsafe fn slice_insert<T>(slice: &mut [MaybeUninit<T>], idx: usize, val:...
function slice_remove (line 39585) | unsafe fn slice_remove<T>(slice: &mut [MaybeUninit<T>], idx: usize) -> T {
function slice_shl (line 39600) | unsafe fn slice_shl<T>(slice: &mut [MaybeUninit<T>], distance: usize) {
function slice_shr (line 39611) | unsafe fn slice_shr<T>(slice: &mut [MaybeUninit<T>], distance: usize) {
function move_to_slice (line 39621) | fn move_to_slice<T>(src: &mut [MaybeUninit<T>], dst: &mut [MaybeUninit<T...
function assert_back_pointers (line 39637) | pub fn assert_back_pointers(self) {
function dump_keys (line 39651) | pub fn dump_keys(self) -> String
function test_splitpoint (line 39674) | fn test_splitpoint() {
function test_partial_eq (line 39698) | fn test_partial_eq() {
function test_sizes (line 39725) | fn test_sizes() {
function fix_node_through_parent (line 39739) | fn fix_node_through_parent(
function fix_node_and_affected_ancestors (line 39785) | pub fn fix_node_and_affected_ancestors(mut self) -> bool {
function fix_top (line 39798) | pub fn fix_top(&mut self) {
function fix_right_border (line 39807) | pub fn fix_right_border(&mut self) {
function fix_left_border (line 39816) | pub fn fix_left_border(&mut self) {
function fix_right_border_of_plentiful (line 39827) | pub fn fix_right_border_of_plentiful(&mut self) {
function fix_left_border_of_left_edge (line 39846) | fn fix_left_border_of_left_edge(mut self) {
function fix_right_border_of_right_edge (line 39853) | fn fix_right_border_of_right_edge(mut self) {
function fix_left_child (line 39866) | fn fix_left_child(self) -> NodeRef<marker::Mut<'a>, K, V, marker::LeafOr...
function fix_right_child (line 39886) | fn fix_right_child(self) -> NodeRef<marker::Mut<'a>, K, V, marker::LeafO...
type TryReserveError (line 39951) | pub enum TryReserveError {
method from (line 39977) | fn from(_: LayoutError) -> Self {
method fmt (line 39984) | fn fmt(
type SpecExtend (line 40001) | trait SpecExtend<I: IntoIterator> {
method spec_extend (line 40003) | fn spec_extend(&mut self, iter: I);
method spec_extend (line 46146) | fn spec_extend(&mut self, iter: I);
type IntoIter (line 40018) | pub struct IntoIter<T> {
function fmt (line 40024) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
type Item (line 40031) | type Item = T;
method next (line 40034) | fn next(&mut self) -> Option<T> {
method size_hint (line 40039) | fn size_hint(&self) -> (usize, Option<usize>) {
method __iterator_get_unchecked (line 40045) | unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item
method next_back (line 40064) | fn next_back(&mut self) -> Option<T> {
method is_empty (line 40071) | fn is_empty(&self) -> bool {
constant MAY_HAVE_SIDE_EFFECT (line 40090) | const MAY_HAVE_SIDE_EFFECT: bool = false;
type Drain (line 40124) | pub struct Drain<'a, T: 'a> {
function fmt (line 40133) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method drop (line 40149) | fn drop(&mut self) {
type Item (line 40210) | type Item = T;
method next (line 40213) | fn next(&mut self) -> Option<T> {
method size_hint (line 40218) | fn size_hint(&self) -> (usize, Option<usize>) {
method next_back (line 40226) | fn next_back(&mut self) -> Option<T> {
type RingSlices (line 40239) | pub trait RingSlices: Sized {
method slice (line 40240) | fn slice(self, from: usize, to: usize) -> Self;
method split_at (line 40241) | fn split_at(self, i: usize) -> (Self, Self);
method ring_slices (line 40243) | fn ring_slices(buf: Self, head: usize, tail: usize) -> (Self, Self) {
method slice (line 40257) | fn slice(self, from: usize, to: usize) -> Self {
method split_at (line 40260) | fn split_at(self, i: usize) -> (Self, Self) {
method slice (line 40266) | fn slice(self, from: usize, to: usize) -> Self {
method split_at (line 40269) | fn split_at(self, i: usize) -> (Self, Self) {
method slice (line 40275) | fn slice(self, from: usize, to: usize) -> Self {
method split_at (line 40282) | fn split_at(self, mid: usize) -> (Self, Self) {
type PairSlices (line 40312) | pub struct PairSlices<'a, 'b, T> {
function from (line 40320) | pub fn from(to: &'a mut VecDeque<T>, from: &'b VecDeque<T>) -> Self {
function has_remainder (line 40326) | pub fn has_remainder(&self) -> bool {
function remainder (line 40330) | pub fn remainder(self) -> impl Iterator<Item = &'b [T]> {
type Item (line 40336) | type Item = (&'a mut [T], &'b [T]);
method next (line 40337) | fn next(&mut self) -> Option<Self::Item> {
constant INITIAL_CAPACITY (line 40415) | const INITIAL_CAPACITY: usize = 7;
constant MINIMUM_CAPACITY (line 40416) | const MINIMUM_CAPACITY: usize = 1;
constant MAXIMUM_ZST_CAPACITY (line 40418) | const MAXIMUM_ZST_CAPACITY: usize = 1 << (usize::BITS - 1);
type VecDeque (line 40440) | pub struct VecDeque<T> {
method clone (line 40453) | fn clone(&self) -> VecDeque<T> {
method clone_from (line 40457) | fn clone_from(&mut self, other: &Self) {
method drop (line 40475) | fn drop(&mut self) {
method default (line 40502) | fn default() -> VecDeque<T> {
function ptr (line 40510) | fn ptr(&self) -> *mut T {
function cap (line 40516) | fn cap(&self) -> usize {
function buffer_as_slice (line 40527) | unsafe fn buffer_as_slice(&self) -> &[T] {
function buffer_as_mut_slice (line 40533) | unsafe fn buffer_as_mut_slice(&mut self) -> &mut [T] {
function buffer_read (line 40539) | unsafe fn buffer_read(&mut self, off: usize) -> T {
function buffer_write (line 40545) | unsafe fn buffer_write(&mut self, off: usize, value: T) {
function is_full (line 40553) | fn is_full(&self) -> bool {
function wrap_index (line 40560) | fn wrap_index(&self, idx: usize) -> usize {
function wrap_add (line 40567) | fn wrap_add(&self, idx: usize, addend: usize) -> usize {
function wrap_sub (line 40574) | fn wrap_sub(&self, idx: usize, subtrahend: usize) -> usize {
function copy (line 40580) | unsafe fn copy(&self, dst: usize, src: usize, len: usize) {
function copy_nonoverlapping (line 40604) | unsafe fn copy_nonoverlapping(&self, dst: usize, src: usize, len: usize) {
function wrap_copy (line 40629) | unsafe fn wrap_copy(&self, dst: usize, src: usize, len: usize) {
function handle_capacity_increase (line 40765) | unsafe fn handle_capacity_increase(&mut self, old_capacity: usize) {
function new (line 40818) | pub fn new() -> VecDeque<T> {
function with_capacity (line 40832) | pub fn with_capacity(capacity: usize) -> VecDeque<T> {
function get (line 40856) | pub fn get(&self, index: usize) -> Option<&T> {
function get_mut (line 40885) | pub fn get_mut(&mut self, index: usize) -> Option<&mut T> {
function swap (line 40918) | pub fn swap(&mut self, i: usize, j: usize) {
function capacity (line 40939) | pub fn capacity(&self) -> usize {
function reserve_exact (line 40966) | pub fn reserve_exact(&mut self, additional: usize) {
function reserve (line 40987) | pub fn reserve(&mut self, additional: usize) {
function try_reserve_exact (line 41040) | pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), Try...
function try_reserve (line 41078) | pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserv...
function shrink_to_fit (line 41112) | pub fn shrink_to_fit(&mut self) {
function shrink_to (line 41138) | pub fn shrink_to(&mut self, min_capacity: usize) {
function truncate (line 41220) | pub fn truncate(&mut self, len: usize) {
function iter (line 41280) | pub fn iter(&self) -> Iter<'_, T> {
function iter_mut (line 41302) | pub fn iter_mut(&mut self) -> IterMut<'_, T> {
function as_slices (line 41341) | pub fn as_slices(&self) -> (&[T], &[T]) {
function as_mut_slices (line 41375) | pub fn as_mut_slices(&mut self) -> (&mut [T], &mut [T]) {
function len (line 41398) | pub fn len(&self) -> usize {
function is_empty (line 41415) | pub fn is_empty(&self) -> bool {
function range_tail_head (line 41419) | fn range_tail_head<R>(&self, range: R) -> (usize, usize)
function range (line 41451) | pub fn range<R>(&self, range: R) -> Iter<'_, T>
function range_mut (line 41490) | pub fn range_mut<R>(&mut self, range: R) -> IterMut<'_, T>
function drain (line 41537) | pub fn drain<R>(&mut self, range: R) -> Drain<'_, T>
function clear (line 41604) | pub fn clear(&mut self) {
function contains (line 41625) | pub fn contains(&self, x: &T) -> bool
function front (line 41649) | pub fn front(&self) -> Option<&T> {
function front_mut (line 41673) | pub fn front_mut(&mut self) -> Option<&mut T> {
function back (line 41693) | pub fn back(&self) -> Option<&T> {
function back_mut (line 41717) | pub fn back_mut(&mut self) -> Option<&mut T> {
function pop_front (line 41738) | pub fn pop_front(&mut self) -> Option<T> {
function pop_back (line 41763) | pub fn pop_back(&mut self) -> Option<T> {
function push_front (line 41786) | pub fn push_front(&mut self, value: T) {
function push_back (line 41811) | pub fn push_back(&mut self, value: T) {
function is_contiguous (line 41822) | fn is_contiguous(&self) -> bool {
function swap_remove_front (line 41853) | pub fn swap_remove_front(&mut self, index: usize) -> Option<T> {
function swap_remove_back (line 41888) | pub fn swap_remove_back(&mut self, index: usize) -> Option<T> {
function insert (line 41922) | pub fn insert(&mut self, index: usize, value: T) {
function remove (line 42144) | pub fn remove(&mut self, index: usize) -> Option<T> {
function split_off (line 42326) | pub fn split_off(&mut self, at: usize) -> Self {
function append (line 42389) | pub fn append(&mut self, other: &mut Self) {
function retain (line 42425) | pub fn retain<F>(&mut self, mut f: F)
function grow (line 42445) | fn grow(&mut self) {
function resize_with (line 42484) | pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut() ->...
function make_contiguous (line 42550) | pub fn make_contiguous(&mut self) -> &mut [T] {
function rotate_left (line 42676) | pub fn rotate_left(&mut self, mid: usize) {
function rotate_right (line 42719) | pub fn rotate_right(&mut self, k: usize) {
function rotate_left_inner (line 42737) | unsafe fn rotate_left_inner(&mut self, mid: usize) {
function rotate_right_inner (line 42746) | unsafe fn rotate_right_inner(&mut self, k: usize) {
function binary_search (line 42803) | pub fn binary_search(&self, x: &T) -> Result<usize, usize>
function binary_search_by (line 42848) | pub fn binary_search_by<'a, F>(&'a self, mut f: F) -> Result<usize, usize>
function binary_search_by_key (line 42905) | pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, mut f: F) -> Resu...
function partition_point (line 42945) | pub fn partition_point<P>(&self, mut pred: P) -> usize
function resize (line 42982) | pub fn resize(&mut self, new_len: usize, value: T) {
function wrap_index (line 42989) | fn wrap_index(index: usize, size: usize) -> usize {
function count (line 42997) | fn count(tail: usize, head: usize, size: usize) -> usize {
method eq (line 43004) | fn eq(&self, other: &VecDeque<A>) -> bool {
method partial_cmp (line 43053) | fn partial_cmp(&self, other: &VecDeque<A>) -> Option<Ordering> {
method cmp (line 43061) | fn cmp(&self, other: &VecDeque<A>) -> Ordering {
method hash (line 43068) | fn hash<H: Hasher>(&self, state: &mut H) {
type Output (line 43082) | type Output = A;
function index (line 43085) | fn index(&self, index: usize) -> &A {
function index_mut (line 43093) | fn index_mut(&mut self, index: usize) -> &mut A {
function from_iter (line 43100) | fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> VecDeque<A> {
type Item (line 43111) | type Item = T;
type IntoIter (line 43112) | type IntoIter = IntoIter<T>;
method into_iter (line 43116) | fn into_iter(self) -> IntoIter<T> {
type Item (line 43123) | type Item = &'a T;
type IntoIter (line 43124) | type IntoIter = Iter<'a, T>;
method into_iter (line 43126) | fn into_iter(self) -> Iter<'a, T> {
type Item (line 43133) | type Item = &'a mut T;
type IntoIter (line 43134) | type IntoIter = IterMut<'a, T>;
method into_iter (line 43136) | fn into_iter(self) -> IterMut<'a, T> {
function extend (line 43143) | fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T) {
function extend_one (line 43165) | fn extend_one(&mut self, elem: A) {
function extend_reserve (line 43170) | fn extend_reserve(&mut self, additional: usize) {
function extend (line 43177) | fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
function extend_one (line 43182) | fn extend_one(&mut self, &elem: &T) {
function extend_reserve (line 43187) | fn extend_reserve(&mut self, additional: usize) {
function fmt (line 43194) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
function from (line 43209) | fn from(mut other: Vec<T>) -> Self {
function from (line 43265) | fn from(mut other: VecDeque<T>) -> Self {
type Iter (line 43294) | pub struct Iter<'a, T: 'a> {
function fmt (line 43302) | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
method clone (line 43311) | fn clone(&self) -> Self {
type Item (line 43318) | type Item = &'a T;
method next (line 43321) | fn next(&mut self) -> Option<&'a T> {
method size_hint (line 43331) | fn size_hint(&self) -> (usize, Option<usize>) {
method fold (line 43336) | fn fold<Acc, F>(self, mut accum: Acc, mut f: F) -> Acc
method try_fold (line 43345) | fn try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R
method nth (line 43370) | fn nth(&mut self, n: usize) -> Option<Self::Item> {
method last (line 43381) | fn last(mut self) -> Option<&'a T> {
method __iterator_get_unchecked (line 43386) | unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item
method next_back (line 43402) | fn next_back(&mut self) -> Option<&'a T> {
method rfold (line 43410) | fn rfold<Acc, F>(self, mut accum: Acc, mut f: F) -> Acc
method try_rfold (line 43419) | fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
method is_empty (line 43446) | fn is_empty(&self) -> bool {
constant MAY_HAVE_SIDE_EFFECT (line 4
Copy disabled (too large)
Download .json
Condensed preview — 162 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (13,938K chars).
[
{
"path": ".github/FUNDING.yml",
"chars": 21,
"preview": "github: [BurntSushi]\n"
},
{
"path": ".github/dependabot.yml",
"chars": 251,
"preview": "version: 2\n\nupdates:\n - package-ecosystem: github-actions\n directory: \"/\"\n schedule:\n interval: semiannually"
},
{
"path": ".github/workflows/ci.yml",
"chars": 12968,
"preview": "name: ci\non:\n pull_request:\n branches:\n - master\n push:\n branches:\n - master\n schedule:\n - cron: '00 01 "
},
{
"path": ".gitignore",
"chars": 93,
"preview": ".*.swp\ndoc\ntags\nexamples/ss10pusa.csv\nbuild\ntarget\nCargo.lock\nscratch*\nbench_large/huge\ntmp/\n"
},
{
"path": ".ignore",
"chars": 9,
"preview": "!.github\n"
},
{
"path": ".vim/coc-settings.json",
"chars": 557,
"preview": "{\n \"rust-analyzer.cargo.allFeatures\": false,\n \"rust-analyzer.linkedProjects\": [\n \"benchmarks/engines/libc/Cargo.tom"
},
{
"path": "COPYING",
"chars": 126,
"preview": "This project is dual-licensed under the Unlicense and MIT licenses.\n\nYou may use this code under the terms of either lic"
},
{
"path": "Cargo.toml",
"chars": 2560,
"preview": "[package]\nname = \"memchr\"\nversion = \"2.8.0\" #:version\nauthors = [\"Andrew Gallant <jamslam@gmail.com>\", \"bluss\"]\ndescrip"
},
{
"path": "LICENSE-MIT",
"chars": 1081,
"preview": "The MIT License (MIT)\n\nCopyright (c) 2015 Andrew Gallant\n\nPermission is hereby granted, free of charge, to any person ob"
},
{
"path": "README.md",
"chars": 9870,
"preview": "memchr\n======\nThis library provides heavily optimized routines for string search primitives.\n\n[ -> anyhow::Result<()> {\n let Some(arg) = std::env::a"
},
{
"path": "benchmarks/engines/rust-bytecount/Cargo.toml",
"chars": 1508,
"preview": "[package]\npublish = false\nname = \"main\"\nversion = \"0.6.4\"\nedition = \"2021\"\n\n[workspace]\n\n[dependencies]\nanyhow = \"1.0.10"
},
{
"path": "benchmarks/engines/rust-bytecount/main.rs",
"chars": 1126,
"preview": "use std::io::Write;\n\nuse shared::{Benchmark, Sample};\n\nfn main() -> anyhow::Result<()> {\n let Some(arg) = std::env::a"
},
{
"path": "benchmarks/engines/rust-jetscii/Cargo.toml",
"chars": 289,
"preview": "[package]\npublish = false\nname = \"main\"\nversion = \"0.5.3\"\nedition = \"2021\"\n\n[workspace]\n\n[dependencies]\nanyhow = \"1.0.10"
},
{
"path": "benchmarks/engines/rust-jetscii/main.rs",
"chars": 1575,
"preview": "use std::io::Write;\n\nuse shared::{Benchmark, Sample};\n\nfn main() -> anyhow::Result<()> {\n let Some(arg) = std::env::a"
},
{
"path": "benchmarks/engines/rust-memchr/Cargo.toml",
"chars": 358,
"preview": "[package]\npublish = false\nname = \"main\"\nversion = \"2.7.6\" # should match current 'memchr' version\nedition = \"2021\"\n\n[wo"
},
{
"path": "benchmarks/engines/rust-memchr/main.rs",
"chars": 11210,
"preview": "use std::io::Write;\n\nuse memchr::arch::all::packedpair::HeuristicFrequencyRank;\n\nuse shared::{Benchmark, Sample};\n\nfn ma"
},
{
"path": "benchmarks/engines/rust-memchrold/Cargo.toml",
"chars": 327,
"preview": "[package]\npublish = false\nname = \"main\"\nversion = \"2.5.0\" # should match 'memchr' version below\nedition = \"2021\"\n\n[work"
},
{
"path": "benchmarks/engines/rust-memchrold/main.rs",
"chars": 5356,
"preview": "use std::io::Write;\n\nuse shared::{Benchmark, Sample};\n\nfn main() -> anyhow::Result<()> {\n let mut args = vec![];\n "
},
{
"path": "benchmarks/engines/rust-sliceslice/Cargo.toml",
"chars": 334,
"preview": "[package]\npublish = false\nname = \"main\"\nversion = \"0.4.3\" # should match 'sliceslice' version below\nedition = \"2021\"\n\n["
},
{
"path": "benchmarks/engines/rust-sliceslice/main.rs",
"chars": 7812,
"preview": "use std::io::Write;\n\nuse shared::{Benchmark, Sample};\n\nfn main() -> anyhow::Result<()> {\n let Some(arg) = std::env::a"
},
{
"path": "benchmarks/engines/rust-std/Cargo.toml",
"chars": 347,
"preview": "[package]\npublish = false\nname = \"main\"\nversion = \"0.0.0\" # we get version from build script\nedition = \"2021\"\n\n[workspa"
},
{
"path": "benchmarks/engines/rust-std/build.rs",
"chars": 649,
"preview": "use std::process::Command;\n\nuse regex_lite::Regex;\n\nfn main() {\n let version = rustc_version().unwrap_or(\"unknown\".to"
},
{
"path": "benchmarks/engines/rust-std/main.rs",
"chars": 2490,
"preview": "use std::io::Write;\n\nuse shared::{Benchmark, Sample};\n\nfn main() -> anyhow::Result<()> {\n let Some(arg) = std::env::a"
},
{
"path": "benchmarks/engines/stringzilla/Cargo.toml",
"chars": 339,
"preview": "[package]\npublish = false\nname = \"main\"\nversion = \"4.0.14\" # should match 'stringzilla' version below\nedition = \"2021\"\n"
},
{
"path": "benchmarks/engines/stringzilla/main.rs",
"chars": 1209,
"preview": "use std::io::Write;\n\nuse shared::{Benchmark, Sample};\n\nuse stringzilla::stringzilla::StringZillableBinary;\n\nfn main() ->"
},
{
"path": "benchmarks/engines.toml",
"chars": 21620,
"preview": "# Engines from C's standard library, i.e., `memchr` and `memmem`.\n\n[[engine]]\n name = \"libc/memchr/oneshot\"\n cwd = \"./"
},
{
"path": "benchmarks/haystacks/README.md",
"chars": 115,
"preview": "This directory contains benchmark corpora. Each sub-directory contains a README\ndocumenting the corpus a bit more.\n"
},
{
"path": "benchmarks/haystacks/code/README.md",
"chars": 423,
"preview": "This data contains corpora generated from source code. These sorts of corpora\nare important because code is something th"
},
{
"path": "benchmarks/haystacks/code/rust-library.rs",
"chars": 1645288,
"preview": "use std::collections::LinkedList;\nuse test::Bencher;\n\n#[bench]\nfn bench_collect_into(b: &mut Bencher) {\n let v = &[0;"
},
{
"path": "benchmarks/haystacks/opensubtitles/README.md",
"chars": 647,
"preview": "These were downloaded and derived from the Open Subtitles data set:\nhttps://opus.nlpl.eu/OpenSubtitles-v2018.php\n\nThe sp"
},
{
"path": "benchmarks/haystacks/opensubtitles/en-huge.txt",
"chars": 613015,
"preview": "Now you can tell 'em.\nWhat for are you mixing in?\nMaybe I don't like to see kids get hurt.\nBreak any bones, son?\nHe's go"
},
{
"path": "benchmarks/haystacks/opensubtitles/en-medium.txt",
"chars": 61436,
"preview": "Now you can tell 'em.\nWhat for are you mixing in?\nMaybe I don't like to see kids get hurt.\nBreak any bones, son?\nHe's go"
},
{
"path": "benchmarks/haystacks/opensubtitles/en-small.txt",
"chars": 1019,
"preview": "Now you can tell 'em.\nWhat for are you mixing in?\nMaybe I don't like to see kids get hurt.\nBreak any bones, son?\nHe's go"
},
{
"path": "benchmarks/haystacks/opensubtitles/en-teeny.txt",
"chars": 28,
"preview": "Sound like Sherlock Holmes.\n"
},
{
"path": "benchmarks/haystacks/opensubtitles/en-tiny.txt",
"chars": 108,
"preview": "I saw you before but I didn't think you were this young\nDoc you're beginning to sound like Sherlock Holmes.\n"
},
{
"path": "benchmarks/haystacks/opensubtitles/ru-huge.txt",
"chars": 348142,
"preview": "-Две недели не даешь мне прохода.\nВот и действуй, чем ты рискуешь?\nЯ думал, что сделаю тебя счастливой.\nТоже мне счастье"
},
{
"path": "benchmarks/haystacks/opensubtitles/ru-medium.txt",
"chars": 34812,
"preview": "-Две недели не даешь мне прохода.\nВот и действуй, чем ты рискуешь?\nЯ думал, что сделаю тебя счастливой.\nТоже мне счастье"
},
{
"path": "benchmarks/haystacks/opensubtitles/ru-small.txt",
"chars": 585,
"preview": "-Две недели не даешь мне прохода.\nВот и действуй, чем ты рискуешь?\nЯ думал, что сделаю тебя счастливой.\nТоже мне счастье"
},
{
"path": "benchmarks/haystacks/opensubtitles/ru-teeny.txt",
"chars": 23,
"preview": "летающий Шерлок Холмс.\n"
},
{
"path": "benchmarks/haystacks/opensubtitles/ru-tiny.txt",
"chars": 96,
"preview": "Это - одно из самых поразительных недавних открытий науки.\nМитч МакКафи, летающий Шерлок Холмс.\n"
},
{
"path": "benchmarks/haystacks/opensubtitles/zh-huge.txt",
"chars": 302055,
"preview": "魯哇克香貓咖啡 世界上最稀有的飲品 Kopi luwak.\nthe rarest beverage in the world.\n嘗一小口 Take a whiff.\n來 Go ahead.\n寇爾先生 董事會已準備好聽你的提案 Uh, mr."
},
{
"path": "benchmarks/haystacks/opensubtitles/zh-medium.txt",
"chars": 43428,
"preview": "魯哇克香貓咖啡 世界上最稀有的飲品 Kopi luwak.\nthe rarest beverage in the world.\n嘗一小口 Take a whiff.\n來 Go ahead.\n寇爾先生 董事會已準備好聽你的提案 Uh, mr."
},
{
"path": "benchmarks/haystacks/opensubtitles/zh-small.txt",
"chars": 736,
"preview": "魯哇克香貓咖啡 世界上最稀有的飲品 Kopi luwak.\nthe rarest beverage in the world.\n嘗一小口 Take a whiff.\n來 Go ahead.\n寇爾先生 董事會已準備好聽你的提案 Uh, mr."
},
{
"path": "benchmarks/haystacks/opensubtitles/zh-teeny.txt",
"chars": 12,
"preview": "汤姆 夏洛克·福尔摩斯\n"
},
{
"path": "benchmarks/haystacks/opensubtitles/zh-tiny.txt",
"chars": 41,
"preview": "谁是早餐界的冠军?\n你突然来信说最近要搬到这里\n帽子不错 汤姆 夏洛克·福尔摩斯\n"
},
{
"path": "benchmarks/haystacks/pathological/README.md",
"chars": 3531,
"preview": "These data sets are specifically crafted to try and defeat heuristic\noptimizations in various substring search implement"
},
{
"path": "benchmarks/haystacks/pathological/defeat-simple-vector-freq.txt",
"chars": 720057,
"preview": "qjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjazqjaz"
},
{
"path": "benchmarks/haystacks/pathological/defeat-simple-vector-repeated.txt",
"chars": 720057,
"preview": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
},
{
"path": "benchmarks/haystacks/pathological/defeat-simple-vector.txt",
"chars": 550004,
"preview": "qazqazqazqazqazqazqazqazqazqazqazqazqazqazqazqazqazqaz\nqazqazqazqazqazqazqazqazqazqazqazqazqazqazqazqazqazqaz\nqazqazqazq"
},
{
"path": "benchmarks/haystacks/pathological/md5-huge.txt",
"chars": 151305,
"preview": "60b725f10c9c85c70d97880dfe8191b3\nbf072e9119077b4e76437a93986787ef\n87c0a0816ee34adc6ce9793e5a5d96ed\n8880cd8c1fb4025857797"
},
{
"path": "benchmarks/haystacks/pathological/random-huge.txt",
"chars": 650000,
"preview": "56be084d3f2715872569c01199344289983528891e88bb026f672d4e20c09c3c\n8da6c3d42db76214c3518cccc6b23083a83c1d238f7f68dcd9ebc97"
},
{
"path": "benchmarks/haystacks/pathological/repeated-rare-huge.txt",
"chars": 500100,
"preview": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
},
{
"path": "benchmarks/haystacks/pathological/repeated-rare-small.txt",
"chars": 1001,
"preview": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
},
{
"path": "benchmarks/haystacks/sherlock/README.md",
"chars": 346,
"preview": "These were the original inputs used for the memchr benchmarks. In theory, they\ncould be replaced with the subtitle text "
},
{
"path": "benchmarks/haystacks/sherlock/huge.txt",
"chars": 594916,
"preview": "Project Gutenberg's The Adventures of Sherlock Holmes, by Arthur Conan Doyle\r\n\r\nThis eBook is for the use of anyone any"
},
{
"path": "benchmarks/haystacks/sherlock/small.txt",
"chars": 664,
"preview": "Mr. Sherlock Holmes, who was usually very late in the mornings, save\nupon those not infrequent occasions when he was up "
},
{
"path": "benchmarks/haystacks/sherlock/tiny.txt",
"chars": 69,
"preview": "Mr. Sherlock Holmes, who was usually very late in the mornings, save\n"
},
{
"path": "benchmarks/haystacks/sliceslice/README.md",
"chars": 1342,
"preview": "These benchmark inputs were taken from the sliceslice [project benchmarks][1].\n\nThese inputs drive two benchmarks, one o"
},
{
"path": "benchmarks/haystacks/sliceslice/haystack.txt",
"chars": 1000,
"preview": "I4BCeTWkpm1G1StV1WP8HKMX1IaRTslq88MOEg4nx7kWLaWYDRDYZrdTtsg26mz9S8DhYcd1ty35aPLyRZSeimOmPAroaqi861z44o35qP9GdrofuuHwdhSE"
},
{
"path": "benchmarks/haystacks/sliceslice/i386-notutf8.txt",
"chars": 805700,
"preview": "INTEL 80386 PROGRAMMER'S REFERENCE MANUAL 1986\n\nIntel Corporation makes no warranty for the use of its products and\nassu"
},
{
"path": "benchmarks/haystacks/sliceslice/i386.txt",
"chars": 805700,
"preview": "INTEL 80386 PROGRAMMER'S REFERENCE MANUAL 1986\n\nIntel Corporation makes no warranty for the use of its products and\nassu"
},
{
"path": "benchmarks/record/aarch64/2023-08-17.csv",
"chars": 152397,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/aarch64/2023-08-20.csv",
"chars": 154348,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/aarch64/2023-08-24.csv",
"chars": 173810,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/aarch64/2023-08-24_2.csv",
"chars": 173830,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/aarch64/2023-08-26.csv",
"chars": 199785,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/aarch64/2023-08-27.csv",
"chars": 199784,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/aarch64/2023-12-29.csv",
"chars": 199741,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-07-31_baseline.csv",
"chars": 101563,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-07.csv",
"chars": 129484,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-09.csv",
"chars": 155043,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-15.csv",
"chars": 155096,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-17.csv",
"chars": 170709,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-20.csv",
"chars": 170765,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-23.csv",
"chars": 190404,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-24.csv",
"chars": 190190,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-24_2.csv",
"chars": 190199,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-25.csv",
"chars": 200518,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-26.csv",
"chars": 200450,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-08-27.csv",
"chars": 130639,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2023-12-29.csv",
"chars": 200669,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/record/x86_64/2025-09-25.csv",
"chars": 210316,
"preview": "name,model,rebar_version,engine,engine_version,err,haystack_len,iters,total,median,mad,mean,stddev,min,max\nmemchr/sherlo"
},
{
"path": "benchmarks/regexes/sliceslice/README.md",
"chars": 470,
"preview": "These needles were taken from the `sliceslice` [project benchmarks][1].\n\nThese inputs drive two benchmarks, one on short"
},
{
"path": "benchmarks/regexes/sliceslice/words-by-length-desc.txt",
"chars": 35288,
"preview": "manipulationinstructions\nmicrocommunications\nvariousconditions\nindistinguishable\nunpredictability\nmicrocontrollers\nunint"
},
{
"path": "benchmarks/regexes/sliceslice/words.txt",
"chars": 35288,
"preview": "a\nA\nAA\nAAA\nAAD\nAAM\nAAS\nAB\nabandoned\nabbreviations\nAbbreviations\nabilities\nability\nable\nabort\nABORT\naborts\nAborts\nabout\na"
},
{
"path": "benchmarks/shared/Cargo.toml",
"chars": 222,
"preview": "[package]\nname = \"shared\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[workspace]\n\n[dependencies]\nanyhow = \"1.0.69\"\nbstr = { ver"
},
{
"path": "benchmarks/shared/lib.rs",
"chars": 11153,
"preview": "use std::{\n io::Read,\n time::{Duration, Instant},\n};\n\nuse {\n anyhow::Context,\n bstr::{ByteSlice, ByteVec},\n}"
},
{
"path": "fuzz/.gitignore",
"chars": 37,
"preview": "/target\n/corpus\n/artifacts\n/coverage\n"
},
{
"path": "fuzz/Cargo.toml",
"chars": 1143,
"preview": "cargo-features = ['named-profiles']\n\n[package]\npublish = false\nname = \"memchr-fuzz\"\nversion = \"0.0.0\"\nauthors = [\"Andrew"
},
{
"path": "fuzz/fuzz_targets/memchr.rs",
"chars": 197,
"preview": "#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse memchr::memchr_iter;\n\nfuzz_target!(|data: &[u8]| {\n if data.is_empty"
},
{
"path": "fuzz/fuzz_targets/memchr2.rs",
"chars": 207,
"preview": "#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse memchr::memchr2_iter;\n\nfuzz_target!(|data: &[u8]| {\n if data.len() <"
},
{
"path": "fuzz/fuzz_targets/memchr3.rs",
"chars": 216,
"preview": "#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse memchr::memchr3_iter;\n\nfuzz_target!(|data: &[u8]| {\n if data.len() <"
},
{
"path": "fuzz/fuzz_targets/memmem.rs",
"chars": 331,
"preview": "#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse memchr::memmem;\n\nfuzz_target!(|data: &[u8]| {\n if data.len() < 2 {\n "
},
{
"path": "fuzz/fuzz_targets/memrchr.rs",
"chars": 203,
"preview": "#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse memchr::memchr_iter;\n\nfuzz_target!(|data: &[u8]| {\n if data.is_empty"
},
{
"path": "fuzz/fuzz_targets/memrchr2.rs",
"chars": 213,
"preview": "#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse memchr::memchr2_iter;\n\nfuzz_target!(|data: &[u8]| {\n if data.len() <"
},
{
"path": "fuzz/fuzz_targets/memrchr3.rs",
"chars": 222,
"preview": "#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse memchr::memchr3_iter;\n\nfuzz_target!(|data: &[u8]| {\n if data.len() <"
},
{
"path": "fuzz/fuzz_targets/memrmem.rs",
"chars": 332,
"preview": "#![no_main]\n\nuse libfuzzer_sys::fuzz_target;\nuse memchr::memmem;\n\nfuzz_target!(|data: &[u8]| {\n if data.len() < 2 {\n "
},
{
"path": "rustfmt.toml",
"chars": 44,
"preview": "max_width = 79\nuse_small_heuristics = \"max\"\n"
},
{
"path": "scripts/make-byte-frequency-table",
"chars": 2038,
"preview": "#!/usr/bin/env python\n\n# This does simple normalized frequency analysis on UTF-8 encoded text. The\n# result of the analy"
},
{
"path": "src/arch/aarch64/memchr.rs",
"chars": 3407,
"preview": "/*!\nWrapper routines for `memchr` and friends.\n\nThese routines choose the best implementation at compile time. (This is\n"
},
{
"path": "src/arch/aarch64/mod.rs",
"chars": 90,
"preview": "/*!\nVector algorithms for the `aarch64` target.\n*/\n\npub mod neon;\n\npub(crate) mod memchr;\n"
},
{
"path": "src/arch/aarch64/neon/memchr.rs",
"chars": 37977,
"preview": "/*!\nThis module defines 128-bit vector implementations of `memchr` and friends.\n\nThe main types in this module are [`One"
},
{
"path": "src/arch/aarch64/neon/mod.rs",
"chars": 112,
"preview": "/*!\nAlgorithms for the `aarch64` target using 128-bit vectors via NEON.\n*/\n\npub mod memchr;\npub mod packedpair;\n"
},
{
"path": "src/arch/aarch64/neon/packedpair.rs",
"chars": 8285,
"preview": "/*!\nA 128-bit vector implementation of the \"packed pair\" SIMD algorithm.\n\nThe \"packed pair\" algorithm is based on the [g"
},
{
"path": "src/arch/all/memchr.rs",
"chars": 37690,
"preview": "/*!\nProvides architecture independent implementations of `memchr` and friends.\n\nThe main types in this module are [`One`"
},
{
"path": "src/arch/all/mod.rs",
"chars": 8348,
"preview": "/*!\nContains architecture independent routines.\n\nThese routines are often used as a \"fallback\" implementation when the m"
},
{
"path": "src/arch/all/packedpair/default_rank.rs",
"chars": 4332,
"preview": "pub(crate) const RANK: [u8; 256] = [\n 55, // '\\x00'\n 52, // '\\x01'\n 51, // '\\x02'\n 50, // '\\x03'\n 49,"
},
{
"path": "src/arch/all/packedpair/mod.rs",
"chars": 14472,
"preview": "/*!\nProvides an architecture independent implementation of the \"packed pair\"\nalgorithm.\n\nThe \"packed pair\" algorithm is "
},
{
"path": "src/arch/all/rabinkarp.rs",
"chars": 14804,
"preview": "/*!\nAn implementation of the [Rabin-Karp substring search algorithm][rabinkarp].\n\nRabin-Karp works by creating a hash of"
},
{
"path": "src/arch/all/shiftor.rs",
"chars": 3125,
"preview": "/*!\nAn implementation of the [Shift-Or substring search algorithm][shiftor].\n\n[shiftor]: https://en.wikipedia.org/wiki/B"
},
{
"path": "src/arch/all/twoway.rs",
"chars": 33321,
"preview": "/*!\nAn implementation of the [Two-Way substring search algorithm][two-way].\n\n[`Finder`] can be built for forward searche"
},
{
"path": "src/arch/generic/memchr.rs",
"chars": 49004,
"preview": "/*!\nGeneric crate-internal routines for the `memchr` family of functions.\n*/\n\n// What follows is a vector algorithm gene"
},
{
"path": "src/arch/generic/mod.rs",
"chars": 557,
"preview": "/*!\nThis module defines \"generic\" routines that can be specialized to specific\narchitectures.\n\nWe don't expose this modu"
},
{
"path": "src/arch/generic/packedpair.rs",
"chars": 12661,
"preview": "/*!\nGeneric crate-internal routines for the \"packed pair\" SIMD algorithm.\n\nThe \"packed pair\" algorithm is based on the ["
},
{
"path": "src/arch/mod.rs",
"chars": 373,
"preview": "/*!\nA module with low-level architecture dependent routines.\n\nThese routines are useful as primitives for tasks not cove"
},
{
"path": "src/arch/wasm32/memchr.rs",
"chars": 3023,
"preview": "/*!\nWrapper routines for `memchr` and friends.\n\nThese routines choose the best implementation at compile time. (This is\n"
},
{
"path": "src/arch/wasm32/mod.rs",
"chars": 92,
"preview": "/*!\nVector algorithms for the `wasm32` target.\n*/\n\npub mod simd128;\n\npub(crate) mod memchr;\n"
},
{
"path": "src/arch/wasm32/simd128/memchr.rs",
"chars": 37465,
"preview": "/*!\nThis module defines 128-bit vector implementations of `memchr` and friends.\n\nThe main types in this module are [`One"
},
{
"path": "src/arch/wasm32/simd128/mod.rs",
"chars": 114,
"preview": "/*!\nAlgorithms for the `wasm32` target using 128-bit vectors via simd128.\n*/\n\npub mod memchr;\npub mod packedpair;\n"
},
{
"path": "src/arch/wasm32/simd128/packedpair.rs",
"chars": 8358,
"preview": "/*!\nA 128-bit vector implementation of the \"packed pair\" SIMD algorithm.\n\nThe \"packed pair\" algorithm is based on the [g"
},
{
"path": "src/arch/x86_64/avx2/memchr.rs",
"chars": 50366,
"preview": "/*!\nThis module defines 256-bit vector implementations of `memchr` and friends.\n\nThe main types in this module are [`One"
},
{
"path": "src/arch/x86_64/avx2/mod.rs",
"chars": 111,
"preview": "/*!\nAlgorithms for the `x86_64` target using 256-bit vectors via AVX2.\n*/\n\npub mod memchr;\npub mod packedpair;\n"
},
{
"path": "src/arch/x86_64/avx2/packedpair.rs",
"chars": 9734,
"preview": "/*!\nA 256-bit vector implementation of the \"packed pair\" SIMD algorithm.\n\nThe \"packed pair\" algorithm is based on the [g"
},
{
"path": "src/arch/x86_64/memchr.rs",
"chars": 10302,
"preview": "/*!\nWrapper routines for `memchr` and friends.\n\nThese routines efficiently dispatch to the best implementation based on "
},
{
"path": "src/arch/x86_64/mod.rs",
"chars": 103,
"preview": "/*!\nVector algorithms for the `x86_64` target.\n*/\n\npub mod avx2;\npub mod sse2;\n\npub(crate) mod memchr;\n"
},
{
"path": "src/arch/x86_64/sse2/memchr.rs",
"chars": 40911,
"preview": "/*!\nThis module defines 128-bit vector implementations of `memchr` and friends.\n\nThe main types in this module are [`One"
},
{
"path": "src/arch/x86_64/sse2/mod.rs",
"chars": 111,
"preview": "/*!\nAlgorithms for the `x86_64` target using 128-bit vectors via SSE2.\n*/\n\npub mod memchr;\npub mod packedpair;\n"
},
{
"path": "src/arch/x86_64/sse2/packedpair.rs",
"chars": 7978,
"preview": "/*!\nA 128-bit vector implementation of the \"packed pair\" SIMD algorithm.\n\nThe \"packed pair\" algorithm is based on the [g"
},
{
"path": "src/cow.rs",
"chars": 2889,
"preview": "use core::ops;\n\n/// A specialized copy-on-write byte string.\n///\n/// The purpose of this type is to permit usage of a \"b"
},
{
"path": "src/ext.rs",
"chars": 1598,
"preview": "/// A trait for adding some helper routines to pointers.\npub(crate) trait Pointer {\n /// Returns the distance, in uni"
},
{
"path": "src/lib.rs",
"chars": 8337,
"preview": "/*!\nThis library provides heavily optimized routines for string search primitives.\n\n# Overview\n\nThis section gives a bri"
},
{
"path": "src/macros.rs",
"chars": 423,
"preview": "// Some feature combinations result in some of these macros never being used.\n// Which is fine. Just squash the warnings"
},
{
"path": "src/memchr.rs",
"chars": 27463,
"preview": "use core::iter::Rev;\n\nuse crate::arch::generic::memchr as generic;\n\n/// Search for the first occurrence of a byte in a s"
},
{
"path": "src/memmem/mod.rs",
"chars": 25045,
"preview": "/*!\nThis module provides forward and reverse substring search routines.\n\nUnlike the standard library's substring search "
},
{
"path": "src/memmem/searcher.rs",
"chars": 39226,
"preview": "use crate::arch::all::{\n packedpair::{HeuristicFrequencyRank, Pair},\n rabinkarp, twoway,\n};\n\n#[cfg(target_arch = \""
},
{
"path": "src/tests/memchr/mod.rs",
"chars": 11159,
"preview": "use alloc::{\n string::{String, ToString},\n vec,\n vec::Vec,\n};\n\nuse crate::ext::Byte;\n\npub(crate) mod naive;\n#[m"
},
{
"path": "src/tests/memchr/naive.rs",
"chars": 827,
"preview": "pub(crate) fn memchr(n1: u8, haystack: &[u8]) -> Option<usize> {\n haystack.iter().position(|&b| b == n1)\n}\n\npub(crate"
},
{
"path": "src/tests/memchr/prop.rs",
"chars": 11609,
"preview": "/// Defines a host of quickcheck tests for the given memchr searcher.\n#[cfg(miri)]\n#[macro_export]\nmacro_rules! define_m"
},
{
"path": "src/tests/mod.rs",
"chars": 362,
"preview": "#[macro_use]\npub(crate) mod memchr;\npub(crate) mod packedpair;\n#[macro_use]\npub(crate) mod substring;\n\n// For debugging,"
},
{
"path": "src/tests/packedpair.rs",
"chars": 8074,
"preview": "use alloc::{boxed::Box, vec, vec::Vec};\n\n/// A set of \"packed pair\" test seeds. Each seed serves as the base for the\n///"
},
{
"path": "src/tests/substring/mod.rs",
"chars": 8430,
"preview": "/*!\nThis module defines tests and test helpers for substring implementations.\n*/\n\nuse alloc::{\n boxed::Box,\n forma"
},
{
"path": "src/tests/substring/naive.rs",
"chars": 1232,
"preview": "/*!\nThis module defines \"naive\" implementations of substring search.\n\nThese are sometimes useful to compare with \"real\" "
},
{
"path": "src/tests/substring/prop.rs",
"chars": 3903,
"preview": "/*!\nThis module defines a few quickcheck properties for substring search.\n\nIt also provides a forward and reverse macro "
},
{
"path": "src/vector.rs",
"chars": 17435,
"preview": "/// A trait for describing vector operations used by vectorized searchers.\n///\n/// The trait is highly constrained to lo"
}
]
// ... and 2 more files (download for full content)
About this extraction
This page contains the full source code of the BurntSushi/rust-memchr GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 162 files (44.2 MB), approximately 3.3M tokens, and a symbol index with 3866 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.