memchr

Extremely fast SIMD-accelerated byte and substring search for Rust

Library
Cargo
v2.8.3
1,570 stars
Unlicense OR MIT

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
61 /100 Good
Development Activity 52
Maintenance 28
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 84
Code Quality 86
Innovation 82
Learning Curve 72

memchr provides heavily optimized routines for searching 1, 2, or 3 bytes within a byte slice, plus a memmem submodule for forward and reverse substring search, all operating on &[u8] without regard to text encoding. On x86_64, aarch64, and wasm32 targets it automatically selects SIMD-accelerated implementations at runtime, falling back to portable code elsewhere.

With over 1.1 billion total downloads, memchr is one of the most widely depended-upon low-level crates in the Rust ecosystem, forming the search backbone underneath tools like ripgrep and many parsing and text-processing libraries. It supports no_std environments and compiles down to minimal, allocation-free primitives.

What You Get

  • Top-level memchr/memchr2/memchr3 functions for searching 1-3 bytes in forward or reverse direction
  • A memmem submodule with forward and reverse substring search over &[u8]
  • Automatic runtime CPU-feature detection to select AVX2/SSE2/NEON-accelerated code paths
  • no_std support (with only the alloc feature) for use in constrained environments
  • wasm32 SIMD-accelerated routines alongside the x86_64 and aarch64 implementations

Common Use Cases

  • Powering fast line- and pattern-search in tools like ripgrep and other grep-style utilities
  • Implementing custom parsers or lexers that need to quickly scan for delimiter bytes
  • Substring search over large byte buffers in log-processing or data-pipeline tools
  • Building no_std embedded tooling that still needs fast byte-search primitives

Under The Hood

Architecture The crate’s roughly 16k lines of source are organized around a top-level API for single/multi-byte search (memchr/memchr2/memchr3) and a memmem module implementing substring search, each backed by architecture-specific SIMD implementations (x86_64 SSE2/AVX2, aarch64 NEON, wasm32 SIMD) selected via runtime CPU-feature detection, with portable fallback code for unsupported targets. Tech Stack Pure Rust (edition 2021, MSRV 1.61), with a std feature (enabled by default) gating the runtime-detection machinery and an alloc-only path for no_std use; a separate benchmarks/ workspace and fuzz/ directory are excluded from the published crate via Cargo.toml’s exclude list to keep the published artifact minimal. Code Quality The project maintains a dedicated fuzz/ corpus for continuous fuzz testing of its search routines and a benchmarks/ suite for tracking the performance regressions that matter most for a crate whose entire value proposition is raw search speed; an explicit AI_POLICY.md in the repo signals a deliberate, actively-governed contribution process. API Design The API surface is intentionally narrow and encoding-agnostic — everything operates on &[u8] rather than str — so it composes cleanly whether callers are working with UTF-8 text or arbitrary binary data, and the std/no_std split is handled via a single Cargo feature rather than separate crates.

Used by 6 apps in this directory

Rust
86%
Other

Arroyo

Analytics · Data Engineering

5,039

A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.

View details
86
Repo Health
74
Technical
62
Dependency
Built with
Rust 86%
Updated 1 weeks ago
Rust
54%
Other

Cap

Team Chat · Video Conferencing

22,884

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
64
Dependency
Built with
Rust 54%
TypeScript 42%
Updated 4 days ago
Rust
100%
Other

Meilisearch

Search

59,424

Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.

View details
89
Repo Health
88
Technical
68
Dependency
Built with
Rust 100%
Updated 1 weeks ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

39,975

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 4 days ago
Rust
98%

Stalwart

Collaboration

14,848

All-in-one secure mail and collaboration server covering IMAP, JMAP, SMTP, CalDAV, CardDAV, and WebDAV in a single memory-safe Rust binary.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
Rust 98%
Updated 5 days ago
Rust
64%
Apache 2.0

Temps

Analytics · Devops · Monitoring

801

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
70
Dependency
Built with
Rust 64%
TypeScript 34%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers