Description
Lots of file wide IDE features will re-populate the Semantics caches all the same, doing a bunch of repeated work due to us creating a new Semantics
instance per request. That is kind of wasted as all the data will be the same!
So ideally we would stash away a Arc<Semantics>
in GlobalState
(or probably Analysis
) somewhere, replace the RefCell
s within with RwLock
s and clone the arc into requests on demand. And whenever a db invalidation comes in, we just replace the stored Arc
with an Arc::default
again to refresh it. This should generally speed up a couple of things I believe. That also means we should be able to cache some more stuff in Semantics
that may be re-used between requests that is prone to invalidations.
Now, we can't really stash away Semantics
itself as it won't be send due to the database handle within, but we can do the same with its caches directly, that is store Arc<RwLock<SourceToDefCache>>
etc...