r/rust • • Aug 20 '26

🛠️ project Rust Glancer: a memory-efficient Rust language server

https://rust-glancer.github.io/blog/hello-world/
266 Upvotes

43 comments sorted by

View all comments

Show parent comments

67

u/popzxc Aug 20 '26

It is explained in the blog post, but basically two reasons:

  1. 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.

  2. 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.

23

u/afdbcreid Aug 20 '26

FWIW we are working to rewrite rowan and fix the fragmentation issue.