diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-25 14:25:50 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-25 14:25:50 +0000 |
commit | 6df1f71b7d0db209978595dc9be496e7f2ef88ec (patch) | |
tree | 17579217a78602653518bc86b96edbf9a80d5437 /crates/ra_ide_api/src/symbol_index.rs | |
parent | aaadc4311ac623a75323611aad5579797616cc02 (diff) | |
parent | 046ae1d361d8941a664919e7668a65ae735d4a1b (diff) |
Merge #641
641: more stats r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/symbol_index.rs')
-rw-r--r-- | crates/ra_ide_api/src/symbol_index.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs index 1b5d1eb1d..69a669b8d 100644 --- a/crates/ra_ide_api/src/symbol_index.rs +++ b/crates/ra_ide_api/src/symbol_index.rs | |||
@@ -23,6 +23,7 @@ use std::{ | |||
23 | cmp::Ordering, | 23 | cmp::Ordering, |
24 | hash::{Hash, Hasher}, | 24 | hash::{Hash, Hasher}, |
25 | sync::Arc, | 25 | sync::Arc, |
26 | mem, | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | use fst::{self, Streamer}; | 29 | use fst::{self, Streamer}; |
@@ -136,6 +137,14 @@ impl SymbolIndex { | |||
136 | self.symbols.len() | 137 | self.symbols.len() |
137 | } | 138 | } |
138 | 139 | ||
140 | pub(crate) fn fst_size(&self) -> usize { | ||
141 | self.map.as_fst().size() | ||
142 | } | ||
143 | |||
144 | pub(crate) fn symbols_size(&self) -> usize { | ||
145 | self.symbols.len() * mem::size_of::<FileSymbol>() | ||
146 | } | ||
147 | |||
139 | pub(crate) fn for_files( | 148 | pub(crate) fn for_files( |
140 | files: impl ParallelIterator<Item = (FileId, TreeArc<SourceFile>)>, | 149 | files: impl ParallelIterator<Item = (FileId, TreeArc<SourceFile>)>, |
141 | ) -> SymbolIndex { | 150 | ) -> SymbolIndex { |