Someone spent 4 months building a Rust LSP that uses 100x less memory
Someone spent 4 months building a Rust LSP that uses 100x less memory
If you write Rust on an 8GB MacBook, you know the drill: open the project, fans spin up, rust-analyzer chews through a few gigabytes of RAM, and Chrome starts swapping. Everyone complained about it for years. Nobody actually did anything about it.
Until someone spent four months building a replacement.
The numbers first
Rust Glancer is a from-scratch alternative to rust-analyzer, built by one developer in four months, with one goal: keep the language server under 100MB of memory.
Measured on the author's own machines:
- 8GB M1 MacBook Pro (2020): full indexing in 9 seconds — rust-analyzer needs 14. RAM stays under 100MB the whole time.
- M4 Max 36GB: 8 seconds vs rust-analyzer's 13.
Not "a bit better". Two orders of magnitude less memory. The project hit 392 points on Hacker News, and the heaviest endorsement comes from matklad, rust-analyzer's own author. He wrote a commentary calling it "incredibly cool" — and casually admitted something uncomfortable about his own project: rowan, the syntax tree library he chose, "is garbage :P".
The core idea: skip incremental, freeze the analysis
Why does rust-analyzer eat so much RAM? The Glancer author breaks it into three parts:
- Rust workspaces genuinely have a lot of information to index. That one's unavoidable.
- Salsa, the incremental query database — cool approach, but data is inherently stuck in memory.
- Rowan, the syntax tree — bought partial invalidation (reparse only the changed line) at the cost of heavy memory fragmentation.
Glancer throws all of that out: no incremental computation. Just a frozen analysis result that gets invalidated on save.
Sounds like a downgrade, but it buys two properties:
- Glancer can shove analysis results out to the filesystem and load them back only when a query asks.
- Restarting your editor doesn't trigger re-indexing — the results are already on disk.
Think of rust-analyzer as a library that spreads every book across the table, ready to grab. Glancer shelves everything and fetches the one book you ask for. Slightly slower per query, but the table stays clean.
Glancer is clever about typing, too: no full analysis per keystroke — just a shallow pass over the current function body, reusing the last complete index. The trade-off: new imports, structs, and traits don't get indexed until you save.
matklad's own admission: 1% use case, 99% sacrifice
matklad's commentary is worth reading beyond the endorsement. Rowan was designed for incremental parsing and DOM-style refactoring, he says — "but that's 1% use case. The 99% use case is all the code in your 6666 dependencies which you won't ever look at, but which needs to be at least shallowly analyzed."
He sketches a bigger vision too: IntelliJ's PSI is an interface, not an implementation. Files open in the editor get concrete syntax trees; the rest of the project gets compact stub trees (no function bodies); dependencies are served straight from compiled .rmeta files. rust-analyzer should only switch to full analysis when you actually start poking around ~/.cargo/registry.
That iceberg architecture — incremental analysis only at the tip, everything else read-only, compact, and on disk — nobody has finished building it. Glancer is a step in that direction.
Don't uninstall rust-analyzer yet
Cold water time. Glancer is not a complete LSP: missing features, known bugs, and hard problems like proc-macro expansion are basically off the table. The author says it plainly: Glancer will never become "rust-analyzer, but better". It's for people with weak machines, or people willing to trade some completeness for RAM.
There's one unexpected win for agentic workflows, though: it ships a custom file watcher where out-of-editor changes get lower priority. When an agent bulk-edits your code, you don't get a re-indexing storm, and inlay hints don't drift out of place — a bug matklad admits rust-analyzer itself struggles with.
What you can do today
- On an 8GB machine: install the VS Code extension and try it. Worst case you uninstall in five minutes.
- Memory isn't your problem: file away "frozen analysis + on-demand loading". It applies to any memory-hungry indexing tool — language servers, CI caches, search indexes.
- Spare 15 minutes: read matklad's commentary in full. It's a textbook architecture retrospective.
✨ Originally drafted by DeepSeek, reviewed and polished by Claude.
Sources: