Skip to content

Latest commit

 

History

History
114 lines (75 loc) · 2.85 KB

File metadata and controls

114 lines (75 loc) · 2.85 KB

GrepTurbo Logo

GrepTurbo

Index-accelerated regex search. Skip irrelevant files entirely.

Go Version License Build Speedup Ask DeepWiki


GrepTurbo builds a local trigram index over your codebase so regex queries skip irrelevant files entirely — instead of scanning every byte like grep. The bigger your codebase, the bigger the win.


Benchmark

Tested on the Go standard library source (~10,000 files):

Tool Time Files Scanned
grep -rn 2.4 – 3.1s All 10,000
GrepTurbo search 0.4 – 0.9s ~50 candidates

6–7x faster on 10k files. Grows with codebase size. Repeated queries get faster as the OS caches the mmap'd index in the page cache.


Install

curl -fsSL https://yanurag-dev.github.io/GrepTurbo/install.sh | bash

Flags

grepturbo init
  (no flags — sets up in current directory)

grepturbo build
  -root   <dir>    Directory to index (default: .)
  -out    <dir>    Where to write the index (default: .grepturbo)

grepturbo <pattern>
  -index  <dir>    Index directory to query (default: .grepturbo)

Usage

Quick Start: Init → Build → Search

Step 1 — initialize (one-time setup for your IDE/editor):

grepturbo init

This sets up GrepTurbo integration so your editor can run searches. Creates .grepturbo/ in the project root.

Step 2 — build the index (once per project, or when files change):

grepturbo build -root ./myproject -out .grepturbo

Walks your codebase, extracts trigrams from each file, builds the inverted index, and writes 3 files to disk:

  • lookup.idx — hash table (mmap'd for fast queries)
  • postings.dat — trigram → file IDs
  • files.idx — file ID → path mapping

Step 3 — search:

# Full syntax
grepturbo search -index .grepturbo 'func.*Error'

# Shorthand (equivalent)
grepturbo 'func.*Error'

Output is file:line:text, same as grep -n:

internal/index/reader.go:25:func NewReader(dir string) (*Reader, error) {
internal/query/search.go:26:func Search(r *index.Reader, pattern string) ([]Match, error) {

Built with Go · MIT License
Coverage