À propos
Outil de recherche de texte rapide doté d’algorithmes avancés, de l’accélération SIMD, du multithreading et de la prise en charge des expressions régulières. Il est conçu pour effectuer rapidement des recherches de motifs à grande échelle grâce aux E/S par mémoire mappée et aux optimisations matérielles.
Outils de développementWhat you can do
- Smart algorithm selection (Boyer-Moore, KMP, Two-Way, Shift-Or, Aho-Corasick)
- SIMD acceleration (SSE2, AVX2, AVX-512, NEON) and memory-mapped I/O
- Multi-threaded search across CPU cores
- POSIX regular expressions and multiple pattern search
Progression mesurée des étoiles
- in 24h
- +1
- in 7 days
- +1
- in 15 days
- +2
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
Originalkrep
A high-performance string search utility for the command line. Fast, multi-threaded, and grep-compatible.
Features
- Smart algorithm selection (Boyer-Moore, KMP, Two-Way, Shift-Or, Aho-Corasick)
- SIMD acceleration (SSE2, AVX2, AVX-512, NEON) and memory-mapped I/O
- Multi-threaded search across CPU cores
- POSIX regular expressions and multiple pattern search
- Recursive directory search with globs, exclusions, and
.gitignoresupport - Grep-compatible context (
-A,-B,-C,-n,-o,-c,-l,-L,-q) - JSON Lines output (
--json) for automation - Colored output
Installation
# macOS (Homebrew)
brew install krep
# From source
git clone https://github.com/davidesantangelo/krep.git
cd krep
make
sudo make install
Requirements: GCC or compatible C compiler, POSIX system (Linux, macOS, BSD), pthread.
Use make PORTABLE=1 for distributable binaries, or make NATIVE=1 to tune a build for your own CPU. Run make clean before changing build flags. Published Linux x86-64 binaries use baseline SSE2; source builds can enable wider vectors supported by the build machine.
Usage
krep [OPTIONS] PATTERN [FILE | DIRECTORY]
krep [OPTIONS] -e PATTERN -e PATTERN ...
krep [OPTIONS] -f FILE # patterns from file (- for stdin)
krep [OPTIONS] -s PATTERN STRING # search in a string instead of a file
cat FILE | krep PATTERN
Examples
krep -F "value: 100%" config.ini # fixed string
krep -r "function" ./project # recursive search
krep -r --gitignore "TODO" ./project # respect .gitignore
krep -r --glob '*.c' --exclude '*/vendor/*' "TODO" .
krep -n -C 2 "panic" app.log # line numbers + context
krep -w 'cat' file.txt # whole words only
krep -r -l "DeprecatedAPI" . # list files with matches
krep -q "required" config.ini # quiet existence check
krep --json "needle" ./src/main.c # JSON Lines output
echo 'pattern' | krep -f - target.txt # patterns from stdin
Options
-i, --ignore-caseCase-insensitive search-c, --countCount matching lines only-o, --only-matchingPrint only the matched parts-n, --line-numberPrefix lines with line numbers-A, -B, -C NUMContext after, before, or around matches-l, -LFiles with / without matches-q, --quietExit status only-e PATTERNSpecify pattern(s), repeatable-f FILERead patterns from file (-for stdin)-m NUMMax matching lines per file-EPOSIX extended regex-FFixed strings (default)-r, --recursiveRecursively search directories--glob=GLOB,--exclude=GLOBInclude/exclude paths--hiddenInclude hidden files--gitignoreRespect.gitignore--algo=ALGOForce algorithm:auto,bm,kmp,bndm,two-t NUM, --threads=NUMThread count (default: auto)-s STRINGSearch in a string instead of files-w, --word-regexpWhole words only--json, --jsonlJSON Lines output--statsPrint summary to stderr--color[=WHEN]Color control (always,never,auto)--no-simdDisable SIMD-v, --version,-h, --help
Performance and testing
Version 3.1.0 adds two-byte SIMD filtering for literals, linear-time line numbering and JSON output, and early exit for existence checks. Measurements against 3.0.2, including hardware, raw samples and limitations, are in the performance report.
make ci # unit, protected-page, directory and CLI tests (Python 3 required)
make sanitize # rebuild and test with ASan + UBSan (Clang required)
make clean && make # restore an optimized build after sanitizer testing
make bench-release # generated local dataset; no download required
python3 test/benchmark_release.py --baseline /path/to/krep-3.0.2 --runs 5
--stats reports matches encountered; -q, -l and -L stop after the first match, so their match totals are intentionally capped at one per searched file. Input byte totals describe the supplied file or buffer sizes, not physical I/O. Stdin is buffered before searching.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Author
- Davide Santangelo - GitHub
License
BSD-2 License - see the LICENSE file for details.
Explorer des projets similaires
Chargement…