Caching the index for gems is easier than caching the entire index because we know the files will only change if the version of the gem has changed.
I think we can get a considerable performance improvement on indexing if we cache the entries for gems. Something like
.ruby-lsp/
Gemfile
Gemfile.lock
cache/
rails-7.1.0
yarp-0.12.0
Where each gem cache is basically a Marshal dump of the index. This may require defining a way to merge different indices.
For the long term, it would be amazing if rubygems could generate the index cache during packaging, so that all gems are exported with an index by default. By doing the work ahead of time, we would be guaranteed to always have cached indices for all gems, significantly speeding up indexing.
### Tasks
- [ ] https://github.com/Shopify/ruby-lsp/issues/1919
- [ ] Cache indexed gems
Caching the index for gems is easier than caching the entire index because we know the files will only change if the version of the gem has changed.
I think we can get a considerable performance improvement on indexing if we cache the entries for gems. Something like
Where each gem cache is basically a Marshal dump of the index. This may require defining a way to merge different indices.
For the long term, it would be amazing if rubygems could generate the index cache during packaging, so that all gems are exported with an index by default. By doing the work ahead of time, we would be guaranteed to always have cached indices for all gems, significantly speeding up indexing.