rust-analyzer / rowan

Apache License 2.0
697 stars 57 forks source link

Add ability to gc node caches #63

Open CAD97 opened 4 years ago

CAD97 commented 4 years ago

Originally implemented in sorbus here: https://github.com/CAD97/sorbus/pull/46

Also exposes the NodeCache (closes #53) so that the gc is usable. While GreenNodeBuilder has had with_cache for a while, it's been impossible to actually share the cache, as there was no way to get a cache to share!

simonvandel commented 4 years ago

What is the effect on peak memory usage for analysis stats using rust analyzer?

CAD97 commented 4 years ago

It's not going to have an immediate impact because r-a doesn't (IIUC) yet hold on to or reuse node caches.

Additionally, it will only potentially have an impact when holding onto a node cache after the deletion of a parse tree. We aren't really generating any garbage to clean up; it's only useful if the cache outlives the tree(s) that it's built.