I Built a Rust Language Server That Uses a Fraction of rust-analyzer’s Memory

https://hackernoon.imgix.net/images/BQfMHbq0nzXa400jBuX3ouwmGN03-io83b18.png
TL;DR. In my setup, one worktree per agent meant one language server per agent, each with its own copy of the same analysis. I tried to share rust-analyzer between worktrees twice, and both attempts half-worked. Then I built a language server that reads what rustc writes down during cargo check. In one single-session run on Bevy with the index already built, it peaked at 917 MB and, after startup, got through the session’s 1,635 requests in 5.5 seconds; rust-analyzer peaked at 11.3 GB and took 114.4 seconds. Several servers running at once are not measured yet.

git worktree add took between 1.1 and 1.7 seconds. The first workspace-wide symbol search in that fresh worktree took rust-analyzer 66.97 seconds. The same search again took 0.10. That was July 2026, on a private workspace of 431 Rust files.

An agent that has just been handed a worktree starts with a question of...

Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE

Read more