Repolode
davidesantangelo

davidesantangelo/krep

A fast, multi-threaded command-line string search tool that is grep-compatible, with SIMD acceleration and regex support.

Open-source alternative to:grep

Stars
529
Forks
26
Open issues
6
Last commit
last month

What is it?

krep is a command-line text search utility written in C, designed as a faster alternative to grep for large-scale pattern matching. It selects among several search algorithms (Boyer-Moore, KMP, Two-Way, Shift-Or, Aho-Corasick) depending on the pattern, and uses SIMD instructions (SSE2, AVX2, AVX-512, NEON) together with memory-mapped I/O to speed up scanning.

The tool supports fixed strings by default, POSIX regular expressions, and multiple patterns supplied via repeated -e flags or a pattern file. It can search files, directories recursively with glob include and exclude rules and .gitignore handling, or standard input. Common grep options such as context lines, line numbers, counts, and file listings are available, along with JSON Lines output for scripting.

krep runs on Linux, macOS, and BSD systems with a C compiler and pthread. Builds can be tuned with PORTABLE or NATIVE make flags to balance portability and CPU-specific vector support.

Key features

  • 01Automatically selects among several string search algorithms based on the pattern
  • 02SIMD acceleration and memory-mapped I/O for fast scanning
  • 03Multi-threaded search across CPU cores
  • 04POSIX regex support and multiple pattern search
  • 05Recursive directory search with globs, exclusions, and .gitignore support
  • 06grep-compatible options plus JSON Lines output

Use cases

  • Searching large source trees or log directories for many patterns at once
  • Scripting text searches that need structured JSON Lines output
  • Replacing grep in performance-sensitive build or CI pipelines
  • Quick existence checks in shell scripts using quiet mode

Quick start

  1. 1

    Install via Homebrew (macOS)

    brew install krep
  2. 2

    Clone the repository

    git clone https://github.com/davidesantangelo/krep.git
  3. 3

    Enter the project directory and build

    cd krep && make
  4. 4

    Install the binary system-wide

    sudo make install

Things to know

  • Requires a C compiler and a POSIX system with pthread, so Windows is not supported.
  • Published Linux x86-64 binaries use baseline SSE2 only; wider SIMD needs a source build.

Topics

FAQ

What is krep?
A fast, multi-threaded command-line string search tool that is grep-compatible, with SIMD acceleration and regex support. krep is a command-line text search utility written in C, designed as a faster alternative to grep for large-scale pattern matching. It selects among several search algorithms (Boyer-Moore, KMP, Two-Way, Shift-Or, Aho-Corasick) depending on the pattern, and uses SIMD instructions (SSE2, AVX2, AVX-512, NEON) together with memory-mapped I/O to speed up scanning.
Is krep free to use? What license does it have?
krep is open source under the BSD-2-Clause license. Check the license terms before using it in commercial products.
Is krep still maintained?
Updated within 6 months. The last commit to krep was on Sep 16, 2026.
What can I use krep for?
Searching large source trees or log directories for many patterns at once Scripting text searches that need structured JSON Lines output Replacing grep in performance-sensitive build or CI pipelines Quick existence checks in shell scripts using quiet mode
How do I install krep?
Install via Homebrew (macOS): brew install krep Clone the repository: git clone https://github.com/davidesantangelo/krep.git Enter the project directory and build: cd krep && make Install the binary system-wide: sudo make install
Where can I get krep?
The source code and installation instructions are on GitHub: https://github.com/davidesantangelo/krep

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects