Skip to content

Explore caching index for gems #1009

Description

@vinistock

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpinnedThis issue or pull request is pinned and won't be marked as staleserverThis pull request should be included in the server gem's release notes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions