From 18c69e7b396f4b71775eb81ff80a5f59072fc7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20F=C3=B6rster?= Date: Fri, 21 Jan 2022 21:06:10 +0100 Subject: [PATCH] Replace CHashMap with DashMap --- Cargo.lock | 150 ++++++++--------------------------- Cargo.toml | 2 +- src/diagnostics/debouncer.rs | 4 +- src/features/build.rs | 4 +- 4 files changed, 36 insertions(+), 124 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 487021a5..4701e2f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -195,16 +195,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chashmap" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff41a3c2c1e39921b9003de14bf0439c7b63a9039637c291e1a64925d8ddfa45" -dependencies = [ - "owning_ref", - "parking_lot 0.4.8", -] - [[package]] name = "chrono" version = "0.4.19" @@ -232,8 +222,8 @@ dependencies = [ "fnv", "indexmap", "log", - "parking_lot 0.11.1", - "rand 0.7.3", + "parking_lot", + "rand", "rayon", "salsa", "serde", @@ -308,7 +298,7 @@ dependencies = [ "salsa", "serde", "serde_derive", - "smallvec 1.6.1", + "smallvec", "string-interner", "strum", "unic-segment", @@ -450,11 +440,22 @@ checksum = "032b71bfa953cd1eb921ac105edb854a94ac038ee1d3da8948a70f22eca40ac1" dependencies = [ "fxhash", "lasso", - "parking_lot 0.11.1", + "parking_lot", "text-size", "triomphe", ] +[[package]] +name = "dashmap" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b799062aaf67eb976af3bdca031ee6f846d2f0a5710ddbb0d2efee33f3cc4760" +dependencies = [ + "cfg-if 1.0.0", + "num_cpus", + "parking_lot", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -583,12 +584,6 @@ dependencies = [ "libc", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "funty" version = "1.1.0" @@ -915,9 +910,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" dependencies = [ "scopeguard", ] @@ -1018,12 +1013,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.4.0" @@ -1185,59 +1174,28 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -dependencies = [ - "stable_deref_trait", -] - [[package]] name = "parking_lot" -version = "0.4.8" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" -dependencies = [ - "owning_ref", - "parking_lot_core 0.2.14", -] - -[[package]] -name = "parking_lot" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.3", + "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.2.14" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" -dependencies = [ - "libc", - "rand 0.4.6", - "smallvec 0.6.14", - "winapi", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ "cfg-if 1.0.0", "instant", "libc", "redox_syscall", - "smallvec 1.6.1", + "smallvec", "winapi", ] @@ -1304,7 +1262,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" dependencies = [ "phf_shared", - "rand 0.7.3", + "rand", ] [[package]] @@ -1396,19 +1354,6 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.7.3" @@ -1418,7 +1363,7 @@ dependencies = [ "getrandom 0.1.16", "libc", "rand_chacha", - "rand_core 0.5.1", + "rand_core", "rand_hc", "rand_pcg", ] @@ -1430,24 +1375,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ "ppv-lite86", - "rand_core 0.5.1", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.5.1" @@ -1463,7 +1393,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core", ] [[package]] @@ -1472,7 +1402,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" dependencies = [ - "rand_core 0.5.1", + "rand_core", ] [[package]] @@ -1500,15 +1430,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.2.9" @@ -1591,10 +1512,10 @@ dependencies = [ "lock_api", "log", "oorandom", - "parking_lot 0.11.1", + "parking_lot", "rustc-hash", "salsa-macros", - "smallvec 1.6.1", + "smallvec", ] [[package]] @@ -1715,15 +1636,6 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbce6d4507c7e4a3962091436e56e95290cb71fa302d0d270e32130b75fbff27" -[[package]] -name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - [[package]] name = "smallvec" version = "1.6.1" @@ -1912,13 +1824,13 @@ dependencies = [ "byteorder", "cancellation", "cfg-if 1.0.0", - "chashmap", "citeproc", "citeproc-db", "citeproc-io", "crossbeam-channel", "csl", "cstree", + "dashmap", "derive_more", "encoding_rs", "encoding_rs_io", diff --git a/Cargo.toml b/Cargo.toml index be49860d..74d3c105 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,13 +34,13 @@ bibutils-sys = { version = "0.1.1", optional = true } byteorder = "1.4.3" cancellation = "0.1" cfg-if = "1.0.0" -chashmap = "2.2.2" citeproc = { git = "https://github.com/cormacrelf/citeproc-rs", rev = "5252fbd8d2046a5a7d5cdcee6c6cb39bd0f1a7f3", optional = true } citeproc-db = { git = "https://github.com/cormacrelf/citeproc-rs", rev = "5252fbd8d2046a5a7d5cdcee6c6cb39bd0f1a7f3", optional = true } citeproc-io = { git = "https://github.com/cormacrelf/citeproc-rs", rev = "5252fbd8d2046a5a7d5cdcee6c6cb39bd0f1a7f3", optional = true } csl = { git = "https://github.com/cormacrelf/citeproc-rs", rev = "5252fbd8d2046a5a7d5cdcee6c6cb39bd0f1a7f3", optional = true } crossbeam-channel = "0.5.2" cstree = "0.6.1" +dashmap = "5.0.0" derive_more = "0.99.17" encoding_rs = "0.8.30" encoding_rs_io = "0.1.7" diff --git a/src/diagnostics/debouncer.rs b/src/diagnostics/debouncer.rs index 46bea801..8c1cb632 100644 --- a/src/diagnostics/debouncer.rs +++ b/src/diagnostics/debouncer.rs @@ -4,8 +4,8 @@ use std::{ time::{Duration, Instant}, }; -use chashmap::CHashMap; use crossbeam_channel::Sender; +use dashmap::DashMap; use crate::{Document, ServerContext, Uri, Workspace}; @@ -31,7 +31,7 @@ impl DiagnosticsDebouncer { let handle = thread::spawn(move || { let pool = threadpool::Builder::new().build(); - let last_task_time_by_uri: Arc, Instant>> = Arc::default(); + let last_task_time_by_uri: Arc, Instant>> = Arc::default(); while let Ok(DiagnosticsMessage::Analyze { workspace, document, diff --git a/src/features/build.rs b/src/features/build.rs index 6953698a..66c5605a 100644 --- a/src/features/build.rs +++ b/src/features/build.rs @@ -8,8 +8,8 @@ use std::{ use anyhow::Result; use cancellation::CancellationToken; -use chashmap::CHashMap; use crossbeam_channel::Sender; +use dashmap::DashMap; use encoding_rs_io::DecodeReaderBytesBuilder; use lsp_types::{ notification::{LogMessage, Progress}, @@ -101,7 +101,7 @@ impl<'a> Drop for ProgressReporter<'a> { #[derive(Default)] pub struct BuildEngine { lock: Mutex<()>, - pub positions_by_uri: CHashMap, Position>, + pub positions_by_uri: DashMap, Position>, } impl BuildEngine {