Fast Search Tools Comparison: ripgrep and Its Alternatives
This article compares the speed and features of various command‑line search utilities—including grep, The Platinum Searcher, ucg, ack, sift, The Silver Searcher, git‑grep and ripgrep—provides benchmark tables for directory and file searches, and outlines ripgrep's capabilities and editor integrations.
The article introduces the fast search tool ripgrep (rg) and compares it with other content‑search utilities such as grep, The Platinum Searcher (pt), UniversalCodeGrep (ucg), ack, sift, The Silver Searcher (ag), and git‑grep.
Directory Search Benchmark
Tool
Command
Time (seconds)
grep grep -FR ext4 . 37.972
ucg ucg -Q --nosmart-case ext4 1.196
pt pt ext4 0.994
ack ack -Q ext4 8.523
sift sift -SQ ext4 1.886
git grep git grep -F ext4 1.911
ag ag -sQ ext4 1.011
rg rg -sF ext4 0.955
File Search Benchmark (Chinese text search)
Tool
Command
Time (seconds)
grep grep '賈母' 24264-0.txt 1.084
ucg ucg '賈母' 24264-0.txt 1.926
pt pt '賈母' 24264-0.txt 0.235
ack ack '賈母' 24264-0.txt 0.845
sift sift '賈母' 24264-0.txt 0.228
git grep git grep --no-index '賈母' 24264-0.txt 1.644
ag ag '賈母' 24264-0.txt 1.585
rg rg '賈母' 24264-0.txt 0.251
Comparison Conclusion
Both pt (The Platinum Searcher) and rg (ripgrep) are the fastest tools; rg offers a rich feature set and overall best performance, while tools like ack or ag provide additional features at slightly slower speeds.
Feature Highlights of ripgrep
Very fast search speed
Rich and practical search capabilities
Supports search‑and‑replace
Can search files with various Chinese encodings using --encoding Configuration via .ripgreprc JSON output support
Can search compressed files (gz, bz2, …)
Result sorting
Honors .gitignore by default (disable with --no-ignore)
Does not search hidden files unless --hidden is used
Skips non‑text files unless --text is specified
Does not follow symlinks unless --follow is enabled
Common ripgrep Commands
Simple search: rg name Makefile Regex search: rg 'name\w+' Makefile Search a directory: rg 'name\w+' Search only specific extensions: rg 'name\w+' -g '*.c' Exclude specific extensions: rg 'name\w+' -g '!*.c' Search only C files: rg 'name\w+' -g '*.{c,h}' or rg 'name\w+' -t c Exclude C files: rg 'name\w+' -T c List supported file types: rg --type-list Add a custom type: rg 'name\w+' --type-add 'web:*.{html,css,js}' -t web Search and replace: rg 'name(\w+)' -r NAME$1 Limit line length to 50 characters: rg 'name\w+' -M 50 Integration with Editors
Vim – use the vim‑ripgrep plugin
Emacs – options include ripgrep.el, counsel‑rg (via ivy), helm‑rg, deadgrep, and color‑rg VSCode – use the vscode‑ripgrep extension
These integrations allow developers to invoke ripgrep directly from their favorite editors, providing fast, on‑the‑fly searching of source code and other text files.
NetEase Game Operations Platform
The NetEase Game Automated Operations Platform delivers stable services for thousands of NetEase titles, focusing on efficient ops workflows, intelligent monitoring, and virtualization.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
