Skip to content

Workspace symbols is very slow #998

@MichaReiser

Description

@MichaReiser

Searching for workspace symbols can be very slow in large projects. We should add some form of caching to workspace symbols to traversing every single file on every request.

I don't think it's necessary to build a full search index. Using only salsa for caching should probably be fine for an initial version:

  • Make symbols_for_file a salsa query that doesn't take any option and returns all symbols of that file. We could consider making it two queries: One that returns hierarchical and another that returns non-hierarchical symbol information. The most important part is that the query isn't parametrized by the query string. Instead, filtering should happen after collecting all symbols. This gives us per-file caching, which should make subsequent lookups very cheap
  • Iterate over all files in workspace_symbols and apply the filtering based on the user input

Metadata

Metadata

Assignees

Labels

performancePotential performance improvementserverRelated to the LSP server

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions