Ray's Knowledge Base
Unlock

Rust search crates cost: ripgrep libs +1.75 MB, regex +1.1 MB, regex-lite +83 KB; a memchr prefilter gives regex-lite near-ripgrep speed

FactVerified 20 Oct 2026Holds anywhere
Fact. A statement and the evidence for it.

Statement#

Release build (opt-level 3, fat LTO, codegen-units 1, strip) on macOS aarch64, added to a 303 KB hello binary: ignore + grep-searcher + grep-regex +1.75 MB; regex (default) +1.13 MB; regex std,perf (no unicode) +745 KB; regex std,unicode (no perf) +760 KB; regex-lite +83 KB; regex-lite + aho-corasick +249 KB. On 115k files (2.2 GB): rg 4.5-5 s, rg -j1 3.0-3.3 s, regex-lite per line 21 s, memchr::memmem literal 2.1 s, memchr prefilter on a required literal then regex-lite 2.4 s with the same hit count as rg. regex-lite matches emoji and Unicode literals and . on one scalar, but \w, \d and (?i) are ASCII only and \p{L} is a compile error.

Evidence#

Measured 2026-10-20 in a scratch crate with cargo build --release and /usr/bin/time; Unicode behavior from a regex-lite test program.