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

Eliminate using clones for TokenMap methods and return references instead. #4960

Closed
JoshuaBatty opened this issue Aug 16, 2023 · 1 comment
Closed
Assignees

Comments

@JoshuaBatty
Copy link
Member

We are doing a lot of clones when returning Idents and Tokens in the language server.

This is primarily to get around ownership issues associated with read/write locks inherit with DashMap.

We now have 2 seperate stages in the server, the first uses DashMap to populate the tokens during AST traversal. The second stage writes the result to a read only map. Currently this type (for example a HashMap) needs to be wrapped in an RwLock to allow for interior mutability because of tower-lsp. Once we remove our dependance on that crate we will be able to use a regular HashMap which should allow for us to return references pretty easily. Should lead to a nice performance win.

@JoshuaBatty
Copy link
Member Author

This was implemented in #5509

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant