Performance
From 18ms to 0.9ms โ the complete optimization saga across five versions. Each iteration a new form, each form more powerful than the last.
โก Benchmark Table
Measured on a 1,247 file Rust project. Pattern: "async fn".
Hardware: AMD Ryzen 9, NVMe SSD, 32GB RAM. p50 latency (10 runs).
| Version | Tool / Mode | Latency (p50) |
|---|---|---|
| V1 | ig (V1 โ naive trigrams) | 18ms |
| V2 | ig (V2 โ index + verification) | 8ms |
| V3 | ig (V3 โ sparse n-grams) | 3ms |
| V4 | ig (V4 โ covering set + mmap) | 1.4ms |
| V5 | ig (V5 โ parallel verify) | 0.9ms โ |
| daemon | ig (daemon mode) | 0.3ms โ |
| goku | Goku (Instant Transmission) [easter egg] | 0.00ms |
* Goku row is a tribute. ig does not yet support ki-based teleportation.
๐ Optimization Timeline
๐ Why Sparse N-grams Beat Trigrams
Longer n-grams appear in fewer files. A 7-gram like "async f"
eliminates 99% of files immediately. Trigrams are too common.
Fewer, more selective n-grams per file โ smaller posting lists โ smaller index. ig's index is typically 2-3MB for a 1000+ file project.
Fewer candidates to intersect means less time in the merge step. Shadow Clone Selection picks the most selective n-grams automatically.
Trigrams (weak): "asy"(3000 files) โฉ "syn"(2100 files) โฉ "ync"(1800 files) = 47 candidates
Sparse n-grams: "async fn"(3 files) = 3 candidates โ 15x fewer candidates to verify