diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Cargo.lock | 20 | ||||
-rw-r--r-- | crates/ra_ide/Cargo.toml | 4 | ||||
-rw-r--r-- | crates/ra_ide_db/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_ide_db/src/symbol_index.rs | 20 |
5 files changed, 14 insertions, 32 deletions
diff --git a/.gitignore b/.gitignore index 99e0c5003..dc5ceca7f 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -6,3 +6,4 @@ crates/*/target | |||
6 | *.log | 6 | *.log |
7 | *.iml | 7 | *.iml |
8 | .vscode/settings.json | 8 | .vscode/settings.json |
9 | cargo-timing*.html | ||
diff --git a/Cargo.lock b/Cargo.lock index c10d72aa4..e7b873076 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -1043,7 +1043,6 @@ version = "0.1.0" | |||
1043 | dependencies = [ | 1043 | dependencies = [ |
1044 | "either", | 1044 | "either", |
1045 | "format-buf", | 1045 | "format-buf", |
1046 | "fst", | ||
1047 | "indexmap", | 1046 | "indexmap", |
1048 | "insta", | 1047 | "insta", |
1049 | "itertools", | 1048 | "itertools", |
@@ -1060,11 +1059,8 @@ dependencies = [ | |||
1060 | "ra_syntax", | 1059 | "ra_syntax", |
1061 | "ra_text_edit", | 1060 | "ra_text_edit", |
1062 | "rand", | 1061 | "rand", |
1063 | "rayon", | ||
1064 | "rustc-hash", | 1062 | "rustc-hash", |
1065 | "superslice", | ||
1066 | "test_utils", | 1063 | "test_utils", |
1067 | "unicase", | ||
1068 | ] | 1064 | ] |
1069 | 1065 | ||
1070 | [[package]] | 1066 | [[package]] |
@@ -1091,7 +1087,6 @@ dependencies = [ | |||
1091 | "rustc-hash", | 1087 | "rustc-hash", |
1092 | "superslice", | 1088 | "superslice", |
1093 | "test_utils", | 1089 | "test_utils", |
1094 | "unicase", | ||
1095 | ] | 1090 | ] |
1096 | 1091 | ||
1097 | [[package]] | 1092 | [[package]] |
@@ -1603,15 +1598,6 @@ dependencies = [ | |||
1603 | ] | 1598 | ] |
1604 | 1599 | ||
1605 | [[package]] | 1600 | [[package]] |
1606 | name = "unicase" | ||
1607 | version = "2.6.0" | ||
1608 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1609 | checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" | ||
1610 | dependencies = [ | ||
1611 | "version_check", | ||
1612 | ] | ||
1613 | |||
1614 | [[package]] | ||
1615 | name = "unicode-bidi" | 1601 | name = "unicode-bidi" |
1616 | version = "0.3.4" | 1602 | version = "0.3.4" |
1617 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1603 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1654,12 +1640,6 @@ dependencies = [ | |||
1654 | ] | 1640 | ] |
1655 | 1641 | ||
1656 | [[package]] | 1642 | [[package]] |
1657 | name = "version_check" | ||
1658 | version = "0.9.1" | ||
1659 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1660 | checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" | ||
1661 | |||
1662 | [[package]] | ||
1663 | name = "walkdir" | 1643 | name = "walkdir" |
1664 | version = "2.3.1" | 1644 | version = "2.3.1" |
1665 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1645 | source = "registry+https://github.com/rust-lang/crates.io-index" |
diff --git a/crates/ra_ide/Cargo.toml b/crates/ra_ide/Cargo.toml index d50cf1d20..97dea5ffd 100644 --- a/crates/ra_ide/Cargo.toml +++ b/crates/ra_ide/Cargo.toml | |||
@@ -17,11 +17,7 @@ indexmap = "1.3.0" | |||
17 | itertools = "0.8.0" | 17 | itertools = "0.8.0" |
18 | join_to_string = "0.1.3" | 18 | join_to_string = "0.1.3" |
19 | log = "0.4.5" | 19 | log = "0.4.5" |
20 | rayon = "1.0.2" | ||
21 | fst = { version = "0.3.1", default-features = false } | ||
22 | rustc-hash = "1.0" | 20 | rustc-hash = "1.0" |
23 | unicase = "2.2.0" | ||
24 | superslice = "1.0.0" | ||
25 | rand = { version = "0.7.0", features = ["small_rng"] } | 21 | rand = { version = "0.7.0", features = ["small_rng"] } |
26 | once_cell = "1.2.0" | 22 | once_cell = "1.2.0" |
27 | 23 | ||
diff --git a/crates/ra_ide_db/Cargo.toml b/crates/ra_ide_db/Cargo.toml index ad3acce59..dbe98f3a0 100644 --- a/crates/ra_ide_db/Cargo.toml +++ b/crates/ra_ide_db/Cargo.toml | |||
@@ -20,7 +20,6 @@ log = "0.4.5" | |||
20 | rayon = "1.0.2" | 20 | rayon = "1.0.2" |
21 | fst = { version = "0.3.1", default-features = false } | 21 | fst = { version = "0.3.1", default-features = false } |
22 | rustc-hash = "1.0" | 22 | rustc-hash = "1.0" |
23 | unicase = "2.2.0" | ||
24 | superslice = "1.0.0" | 23 | superslice = "1.0.0" |
25 | once_cell = "1.2.0" | 24 | once_cell = "1.2.0" |
26 | 25 | ||
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index 64ddf2f95..e6b3126b6 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs | |||
@@ -21,6 +21,7 @@ | |||
21 | //! those FSTs. | 21 | //! those FSTs. |
22 | 22 | ||
23 | use std::{ | 23 | use std::{ |
24 | cmp::Ordering, | ||
24 | fmt, | 25 | fmt, |
25 | hash::{Hash, Hasher}, | 26 | hash::{Hash, Hasher}, |
26 | mem, | 27 | mem, |
@@ -187,29 +188,34 @@ impl Hash for SymbolIndex { | |||
187 | 188 | ||
188 | impl SymbolIndex { | 189 | impl SymbolIndex { |
189 | fn new(mut symbols: Vec<FileSymbol>) -> SymbolIndex { | 190 | fn new(mut symbols: Vec<FileSymbol>) -> SymbolIndex { |
190 | fn cmp_key<'a>(s1: &'a FileSymbol) -> impl Ord + 'a { | 191 | fn cmp(lhs: &FileSymbol, rhs: &FileSymbol) -> Ordering { |
191 | unicase::Ascii::new(s1.name.as_str()) | 192 | let lhs_chars = lhs.name.chars().map(|c| c.to_ascii_lowercase()); |
193 | let rhs_chars = rhs.name.chars().map(|c| c.to_ascii_lowercase()); | ||
194 | lhs_chars.cmp(rhs_chars) | ||
192 | } | 195 | } |
196 | |||
193 | #[cfg(not(feature = "wasm"))] | 197 | #[cfg(not(feature = "wasm"))] |
194 | symbols.par_sort_by(|s1, s2| cmp_key(s1).cmp(&cmp_key(s2))); | 198 | symbols.par_sort_by(cmp); |
195 | 199 | ||
196 | #[cfg(feature = "wasm")] | 200 | #[cfg(feature = "wasm")] |
197 | symbols.sort_by(|s1, s2| cmp_key(s1).cmp(&cmp_key(s2))); | 201 | symbols.sort_by(cmp); |
198 | 202 | ||
199 | let mut builder = fst::MapBuilder::memory(); | 203 | let mut builder = fst::MapBuilder::memory(); |
200 | 204 | ||
201 | let mut last_batch_start = 0; | 205 | let mut last_batch_start = 0; |
202 | 206 | ||
203 | for idx in 0..symbols.len() { | 207 | for idx in 0..symbols.len() { |
204 | if symbols.get(last_batch_start).map(cmp_key) == symbols.get(idx + 1).map(cmp_key) { | 208 | if let Some(next_symbol) = symbols.get(idx + 1) { |
205 | continue; | 209 | if cmp(&symbols[last_batch_start], next_symbol) == Ordering::Equal { |
210 | continue; | ||
211 | } | ||
206 | } | 212 | } |
207 | 213 | ||
208 | let start = last_batch_start; | 214 | let start = last_batch_start; |
209 | let end = idx + 1; | 215 | let end = idx + 1; |
210 | last_batch_start = end; | 216 | last_batch_start = end; |
211 | 217 | ||
212 | let key = symbols[start].name.as_str().to_lowercase(); | 218 | let key = symbols[start].name.as_str().to_ascii_lowercase(); |
213 | let value = SymbolIndex::range_to_map_value(start, end); | 219 | let value = SymbolIndex::range_to_map_value(start, end); |
214 | 220 | ||
215 | builder.insert(key, value).unwrap(); | 221 | builder.insert(key, value).unwrap(); |