Skip to content

Consider sharing Semantics caches between requests #20003

Open
@Veykril

Description

@Veykril

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 RefCells within with RwLocks 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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-idegeneral IDE featuresA-perfperformance issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions