aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/world.rs
diff options
context:
space:
mode:
authorEmil Lauridsen <[email protected]>2020-01-23 08:26:08 +0000
committerEmil Lauridsen <[email protected]>2020-01-23 08:26:08 +0000
commit05aa5b854b230c2f6ba182c0f2c94f3de9a47204 (patch)
treed12e106a8fe4b2317d47f0ff727d34d4251fd2f8 /crates/ra_lsp_server/src/world.rs
parent2fb8a461225800ca605a9f2e997cd5e82fb37574 (diff)
Remove RWLock from check watcher.
@matklad mentioned this might be a good idea. So the general idea is that we don't really need the lock, as we can just clone the check watcher state when creating a snapshot. We can then use `Arc::get_mut` to get mutable access to the state from `WorldState` when needed. Running with this it seems to improve responsiveness a bit while cargo is running, but I have no hard numbers to prove it. In any case, a serialization point less is always better when we're trying to be responsive.
Diffstat (limited to 'crates/ra_lsp_server/src/world.rs')
-rw-r--r--crates/ra_lsp_server/src/world.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs
index e7a0acfc7..3059ef9ec 100644
--- a/crates/ra_lsp_server/src/world.rs
+++ b/crates/ra_lsp_server/src/world.rs
@@ -63,7 +63,7 @@ pub struct WorldSnapshot {
63 pub workspaces: Arc<Vec<ProjectWorkspace>>, 63 pub workspaces: Arc<Vec<ProjectWorkspace>>,
64 pub analysis: Analysis, 64 pub analysis: Analysis,
65 pub latest_requests: Arc<RwLock<LatestRequests>>, 65 pub latest_requests: Arc<RwLock<LatestRequests>>,
66 pub check_watcher: Arc<RwLock<CheckState>>, 66 pub check_watcher: CheckState,
67 vfs: Arc<RwLock<Vfs>>, 67 vfs: Arc<RwLock<Vfs>>,
68} 68}
69 69
@@ -220,7 +220,7 @@ impl WorldState {
220 analysis: self.analysis_host.analysis(), 220 analysis: self.analysis_host.analysis(),
221 vfs: Arc::clone(&self.vfs), 221 vfs: Arc::clone(&self.vfs),
222 latest_requests: Arc::clone(&self.latest_requests), 222 latest_requests: Arc::clone(&self.latest_requests),
223 check_watcher: self.check_watcher.state.clone(), 223 check_watcher: (*self.check_watcher.state).clone(),
224 } 224 }
225 } 225 }
226 226