hokein added inline comments.

================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1125
+    Old = std::move(FileToHighlightings[File]);
+    FileToHighlightings[File] = Highlightings;
+  }
----------------
ilya-biryukov wrote:
> NIT: avoid copying (from `Highlightings` into the map) under a lock, make the 
> copy outside the lock instead
I think we can even avoid copy, since we only use the `Highlightings` for 
calculating the diff.

Maybe just 

```
{
    std::lock_guard<std::mutex> Lock(HighlightingsMutex);
    Old = std::move(FileToHighlightings[File]);
}
// calculate the diff.
{  
     std::lock_guard<std::mutex> Lock(HighlightingsMutex);
     FileToHighlightings[File] = std::move(Highlightings);
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64475/new/

https://reviews.llvm.org/D64475



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to