castwide / solargraph

A Ruby language server.
https://solargraph.org
MIT License
1.87k stars 154 forks source link

Batch processing of changed files for improved performance #638

Closed naveg closed 1 year ago

naveg commented 1 year ago

When multiple files change on disk (eg after a git branch change), solargraph does a re-index operation for each change, because the changes are processed individually. Indexing is a slow operation that can take 10s of seconds on a very large codebase. These codebases are also likely to have 10s or even 100s of changed files when checking out a different git branch. This led to solargraph being very slow.

We can instead process all of the changed files in one go, requiring only a single re-index.

This change also removes the would_merge? method, which is unnecessary and redundant with merge, which already checks if a source should be included.

castwide commented 1 year ago

Looks great, thanks! I noticed that the Library#create method might also be redundant now, but that can be handled as a separate issue.