https://github.com/alexpasmantier/grip-grab Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions By size + Enterprise + Teams + Startups By industry + Healthcare + Financial services + Manufacturing By use case + CI/CD & Automation + DevOps + DevSecOps * Resources Topics + AI + DevOps + Security + Software Development + View all Explore + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up Reseting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} alexpasmantier / grip-grab Public * Notifications You must be signed in to change notification settings * Fork 0 * Star 34 A somewhat faster, more lightweight, ripgrep-inspired alternative. crates.io/crates/grip-grab License Unlicense license 34 stars 0 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights alexpasmantier/grip-grab This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit Last commit message date Latest commit History 66 Commits .github/workflows .github/ workflows src src .gitignore .gitignore Cargo.lock Cargo.lock Cargo.toml Cargo.toml LICENSE LICENSE README.md README.md View all files Repository files navigation * README * Unlicense license grip-grab (gg) A circumstantially faster, more lightweight, ripgrep-inspired alternative. gg "\b(Read|Write)Half[^<]" tokio/src gg.mp4 Installation Using Cargo cargo install grip-grab NOTE: if using zsh with the git plugin, you might need to unalias gg in order for grip-grab's gg to work: echo 'unalias gg' >> ~/.zshrc source ~/.zshrc Usage gg --help A somewhat faster, more lightweight, ripgrep-inspired alternative. Usage: gg [OPTIONS] [PATTERN] [PATHS]... Arguments: [PATTERN] a regex pattern to search for [PATHS]... paths in which to search recursively Options: -e, --patterns you can specify multiple patterns using -e "pattern1" -e "pattern2" etc -I, --ignore-paths paths to ignore when recursively walking target directory -G, --disregard-gitignore disregard .gitignore rules when recursively walking directory (defaults to false) -M, --max-results upper boundary for the number of results to expect (will panic if #results > max_results) [default: 1000] -T, --n-threads number of threads to use [default: 4] -U, --multiline enable multiline matching --json output in JSON format -f, --file-paths-only output file paths only -A, --absolute-paths output absolute paths (defaults to relative) -C, --disable-colored-output disable colored output (colored by default) -t, --filter-filetypes filter on filetype (defaults to all filetypes) -H, --disable-hyperlinks disable hyperlinks in output (defaults to false) -h, --help Print help -V, --version Print version Benchmarks The general idea With default settings for both tools, gg will typically be faster than ripgrep on small to moderatly sized codebases (<= a couple milion lines) running on everyday machines because of its default thread heuristic. rg will typically be faster out of the box on larger corpora (think a checkout of the linux kernel) and machines with more logical cpus. Note that you still can tweak gg with the -T argument to achieve similar performance in those cases. The following discussion with ripgrep's author on HackerNews might also provide more insights regarding this tool's performance (including more benchmarks across different machines and corpora). The curl codebase (approx. half a milion lines) https://github.com/curl/curl hyperfine "rg '[A-Z]+_NOBODY' ." "gg '[A-Z]+_NOBODY'" "grep -rE '[A-Z]+_NOBODY' ." Benchmark 1: rg '[A-Z]+_NOBODY' . Time (mean +- s): 38.5 ms +- 2.2 ms [User: 18.1 ms, System: 207.3 ms] Range (min ... max): 33.8 ms ... 42.8 ms 72 runs Benchmark 2: gg '[A-Z]+_NOBODY' Time (mean +- s): 21.8 ms +- 0.8 ms [User: 15.4 ms, System: 53.1 ms] Range (min ... max): 20.2 ms ... 23.8 ms 115 runs Benchmark 3: ggrep -rE '[A-Z]+_NOBODY' . Time (mean +- s): 73.3 ms +- 0.9 ms [User: 26.5 ms, System: 45.7 ms] Range (min ... max): 70.8 ms ... 75.6 ms 41 runs Summary gg '[A-Z]+_NOBODY' ran 1.77 +- 0.12 times faster than rg '[A-Z]+_NOBODY' . 3.36 +- 0.13 times faster than ggrep -rE '[A-Z]+_NOBODY' . The tokio codebase (approx. 160k lines) https://github.com/tokio-rs/tokio hyperfine "gg 'in<\w, W>'" "rg 'in<\w, W>'" "ggrep -r 'in<[[:alnum:]], W>'" Benchmark 1: gg 'in<\w, W>' Time (mean +- s): 9.6 ms +- 0.5 ms [User: 6.3 ms, System: 9.2 ms] Range (min ... max): 9.0 ms ... 11.5 ms 236 runs Benchmark 2: rg 'in<\w, W>' Time (mean +- s): 11.1 ms +- 0.7 ms [User: 7.3 ms, System: 20.6 ms] Range (min ... max): 9.6 ms ... 12.8 ms 216 runs Benchmark 3: ggrep -r 'in<[[:alnum:]], W>' Time (mean +- s): 442.0 ms +- 3.0 ms [User: 348.6 ms, System: 92.5 ms] Range (min ... max): 439.0 ms ... 446.1 ms 10 runs Summary gg 'in<\w, W>' ran 1.15 +- 0.09 times faster than rg 'in<\w, W>' 46.02 +- 2.49 times faster than ggrep -r 'in<[[:alnum:]], W>' Examples Basic usage gg "\b(Read|Write)Half[^<]" tokio/src Screenshot 2024-07-26 at 14 00 31 JSON output gg --json unsplit tokio/src | jq Screenshot 2024-07-24 at 13 25 29 Filenames only gg -f "\b(Read|Write)Half[^<]" tokio/src Screenshot 2024-07-24 at 13 29 52 Notes This lightweight utility is largely based on a couple of crates from the extraordinary ripgrep tool. Its aim is to provide a minimal and lightweight version that can be easily integrated in other programs for search-related purproses. About A somewhat faster, more lightweight, ripgrep-inspired alternative. crates.io/crates/grip-grab Topics search rust cli json terminal regex speed ag grep ripgrep Resources Readme License Unlicense license Activity Stars 34 stars Watchers 1 watching Forks 0 forks Report repository Releases 2 v0.2.26 Latest Aug 25, 2024 + 1 release Packages 0 No packages published Languages * Rust 100.0% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.