Engineering
11 min read
Indexing two million lines in six minutes
A walk through the streaming indexer behind Kestrel 2.2: parallel parsing, smarter skips and a cache that survives branch switches.
Priya Raman
Infrastructure

Before Kestrel can plan, it needs a map of your code. On large monorepos, building that map was the slowest part of getting started. Kestrel 2.2 makes it up to four times faster.
Where the time went
Profiling showed most of the time went to code nobody reads: vendored packages, build output and lock files. In one customer repository, 71% of indexed lines were generated.
Step | Before | After |
Walk the file tree | 48s | 9s |
Parse source files | 17m 10s | 4m 02s |
Build the symbol graph | 6m 30s | 1m 41s |
Total, 2.1M lines | 24m 28s | 5m 52s |
Three changes
1. Skip generated code by default
The indexer now reads .gitignore and a new .kestrelignore file. Common folders like node_modules and dist are skipped without any setup.
2. Parse in parallel
Files are streamed to a worker pool sized to your machine. On an eight-core laptop, parsing is now limited by disk speed, not CPU.
3. Cache across branches
Switching branches used to start from zero. Now the index is keyed by file content, so only files that changed are parsed again.

Indexing is the first thing a new user waits for. Cutting it from twenty minutes to six changed how many teams finish setup on day one.