Eliminate using clones for TokenMap
methods and return references instead.
#4960
Labels
TokenMap
methods and return references instead.
#4960
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 anRwLock
to allow for interior mutability because oftower-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.The text was updated successfully, but these errors were encountered: