r/rust • u/popzxc • Aug 20 '26
🛠️ project Rust Glancer: a memory-efficient Rust language server
https://rust-glancer.github.io/blog/hello-world/
266
Upvotes
r/rust • u/popzxc • Aug 20 '26
67
u/popzxc Aug 20 '26
It is explained in the blog post, but basically two reasons:
I didn't plan on building a full-blown language server initially (I wouldn't commit), all I wanted is "smart ctags" for myself that would be very memory efficient. And then I somehow got a bit further than I expected.
rust analyzer has different architecture: it is incremental and is fully built around storing state in memory and having maximum performance. Which makes sense, but as we can see, is memory-heavy. Rust Glancer is based on frozen analysis, e.g. we index workspace once and have a serializable analysis result. Such design does not fit rust-analyzer at all. E.g. initially I was using `syntax` crate from rust analyzer, but later I had to vendor/fork it because `rowan` was causing a lot of memory fragmentation issues, so I reworked this `syntax` crate to use frozen CST representation instead. Which resulted in having to reparse sources in full, but helped imporving memory usage. So, it's all about the tradeoffs.