Fast goto definition with low memory footprint
· 9 min read
Metals throws away its navigation index when it shuts down. Next time it starts, the index is computed again from scratch. Although this approach is simple, it requires indexing to be fast enough so you don't mind running it again and again. Also, because we don't persist the index to disk, we need to be careful with memory usage.
This post covers how Metals achieves fast source indexing for Scala with a small memory footprint. We describe the problem statement, explain the initial solution and how an optimization delivered a 10x speedup. Finally, we evaluate the result on a real-world project.