Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use code units cache API #2704

Merged
merged 7 commits into from
Oct 10, 2024
Merged

Use code units cache API #2704

merged 7 commits into from
Oct 10, 2024

Conversation

vinistock
Copy link
Member

Motivation

Closes #2674, closes #2671

This PR adopts the new code units cache API from Prism, so that code unit locations can be computed faster.

Implementation

I recommend reviewing by commit. The new API allows us to instantiate a code units cache ahead of time, which is then passed to get the code units in a more performant way. In places where we previously passed the encoding, we now pass the cache.

Note: this actually fixed a bug in the locations for semantic highlighting.

Automated Tests

Existing tests cover it, but I fixed one of them which had an incorrect expectation.

@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Oct 10, 2024
@vinistock vinistock self-assigned this Oct 10, 2024
@vinistock vinistock requested a review from a team as a code owner October 10, 2024 18:00
@andyw8
Copy link
Contributor

andyw8 commented Oct 10, 2024

I'm seeing indexing take 1m45s on core now, are you getting around the same?

@vinistock
Copy link
Member Author

How are you measuring that? My benchmarks are showing an average of 29 seconds.

@andyw8
Copy link
Contributor

andyw8 commented Oct 10, 2024

That was through VS Code, ruby-lsp --time-index gives 43s.

Copy link
Contributor

@andyw8 andyw8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know yet know how else we'd do it, but it seems unfortunate that so many places in the code now need be aware of this cache.

@vinistock vinistock merged commit aab9990 into main Oct 10, 2024
37 checks passed
@vinistock vinistock deleted the vs-use-code-units-cache branch October 10, 2024 21:15
@vinistock vinistock added breaking-change Non-backward compatible change and removed bugfix This PR will fix an existing bug labels Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Non-backward compatible change server This pull request should be included in the server gem's release notes
Projects
None yet
2 participants