Live data from Hacker News

Rust Glancer: Rust LSP using 100x less RAM

rust-glancer.github.io

61–70 of 129 posts

Re: Rust Glancer: Rust LSP using 100x less RAM

#61
post #55

I personally don’t agree with “LLMs are just a tool” but I’m honestly impressed by the author’s description of LLM usage and taking the responsibility for the code. IMHO, without having looked at the code base itself, this sounds like a pretty healthy way to approach LLM usage!

"I personally don’t agree with “LLMs are just a tool”" Then what are they?

Tool users.

Re: Rust Glancer: Rust LSP using 100x less RAM

#62
post #57
post #54

Earlier quoted context omitted.

The goal always was to refactor rustc to make compiler-based LSP feasible. The idea of original RLS, "we'll just use the compiler", is fundamentally sound. It's just that you'll need to turn the compiler sideways to achieve that, which is a hard work to motivate without having a real example demonstrating the benefits (or having political clout in the project to just mandate that ^^)

[flagged]

[deleted]

Re: Rust Glancer: Rust LSP using 100x less RAM

#65
post #42

While I respect the work behind rust-analyzer greatly and think it's a good part of how cool the language is, I will NEVER understand the design decision to flat out refuse using disk cache. I understand the argument that implementing this puts less pressure behind speeding up the indexing process, but honestly with the price of ram today I'm tired of the memory and cpu usage each rust-analyzer process takes up. Espe…

rust-analyzer taking 2GiB of RAM per instance definitely hurts. And I agree that efforts to reduce this are noble and warranted, but I worry about what doesn’t happen because of those optimisations. The rust tooling is just so-so good (and a better argument for the language than memory safety imo), so I support more efforts to be ergonomic over memory optimisation. Even though rust-analyzer is often the largest memor…

I wish it only took 2gb on my project. It regularly goes over 8gb, I started running it in a cgroup limited to 8gb so it gets killed when it goes over instead of causing problems for the rest of my system. Hits it all the time. I have 64 GB of ram, but my project uses docker to monitor games servers which are also ram hungry so it's still a huge problem when testing. RA acts like they expect to be the only thing running on your pc.

Re: Rust Glancer: Rust LSP using 100x less RAM

#66
post #48
post #45

Earlier quoted context omitted.

Super cool! In the comparison table, you indicate indexing times. Could you also measure memory usage, since that's the stated goal of the project?

I will work on creating a more or less fair benchmark soon-ish, but right now the initial indexing typically consumes more RAM than rust analyzer does, but not awfully so. The difference, however, is that with Rust Glancer you don’t need full reindexing often, so it probably compensates for that to a degree.

Oh, if peak RAM usage is higher, in which scenario do you find that's a significant gain? Maybe I misunderstood, what I got from the blog post is that there will be indexing on save (vs on each keystroke with RA). That would be often enough that lower RAM enough in between would not be of much gain. Is that only an incremental indexing with normally low RAM usage? So you would essentially fully index only once per project, + whenever you upgrade dependencies or upgrade rustc?

Re: Rust Glancer: Rust LSP using 100x less RAM

#67
post #50

While I respect the work behind rust-analyzer greatly and think it's a good part of how cool the language is, I will NEVER understand the design decision to flat out refuse using disk cache. I understand the argument that implementing this puts less pressure behind speeding up the indexing process, but honestly with the price of ram today I'm tired of the memory and cpu usage each rust-analyzer process takes up. Espe…

I can shed some light here! This is going to be longish comment, but hopefully by the end of it you should understand _why_ we decided to avoid using the disk initially, even if you don't agree with that decision. Historically, the decision to not use disk traces back to this comment https://github.com/rust-lang/rfcs/pull/1317#issuecomment-150... , which is perhaps the single GitHub comment that influenced my life mo…

It would be nice if you could configure a maximum memory amount it's allowed to use. It regularly goes over 13gb in my large workspace so I have to configure it to run in a cgroup so it gets killed when it goes over 8gb or I can't run the other things on my desktop that I need to. I restart nvim after it crashes and it's back to around 6gb and working fine so it doesn't seem to need 13 GB to function. If it could handle that gracefully on it's own without cgroups/restarts that'd be a win. Regardless, thanks for your work on RA!

Re: Rust Glancer: Rust LSP using 100x less RAM

#68
post #66
post #48

Earlier quoted context omitted.

I will work on creating a more or less fair benchmark soon-ish, but right now the initial indexing typically consumes more RAM than rust analyzer does, but not awfully so. The difference, however, is that with Rust Glancer you don’t need full reindexing often, so it probably compensates for that to a degree.

Oh, if peak RAM usage is higher, in which scenario do you find that's a significant gain? Maybe I misunderstood, what I got from the blog post is that there will be indexing on save (vs on each keystroke with RA). That would be often enough that lower RAM enough in between would not be of much gain. Is that only an incremental indexing with normally low RAM usage? So you would essentially fully index only once per pr…

It looks like it only partially reindexes on save, but it completely reindexes the single file that’s saved, rather than doing partial reindex of the file on every keystroke like rust-analyser.

But importantly it’s not reindexing the entire project, which is the expensive operation. So you have higher peak RAM when opening a brand new project, but much lower RAM usage while working on the project.

Re: Rust Glancer: Rust LSP using 100x less RAM

#69
post #42

While I respect the work behind rust-analyzer greatly and think it's a good part of how cool the language is, I will NEVER understand the design decision to flat out refuse using disk cache. I understand the argument that implementing this puts less pressure behind speeding up the indexing process, but honestly with the price of ram today I'm tired of the memory and cpu usage each rust-analyzer process takes up. Espe…

rust-analyzer taking 2GiB of RAM per instance definitely hurts. And I agree that efforts to reduce this are noble and warranted, but I worry about what doesn’t happen because of those optimisations. The rust tooling is just so-so good (and a better argument for the language than memory safety imo), so I support more efforts to be ergonomic over memory optimisation. Even though rust-analyzer is often the largest memor…

I would think there has to be some decent middle ground like storing some structures on disk mmap'd and letting the kernel handle back pressure and caching
Post reply on HN