diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide_api/src/status.rs | 12 | ||||
-rw-r--r-- | crates/ra_ide_api/src/symbol_index.rs | 8 |
2 files changed, 5 insertions, 15 deletions
diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs index 717537fcd..59159df98 100644 --- a/crates/ra_ide_api/src/status.rs +++ b/crates/ra_ide_api/src/status.rs | |||
@@ -94,17 +94,12 @@ impl FromIterator<TableEntry<FileId, TreeArc<SourceFile>>> for SyntaxTreeStats { | |||
94 | #[derive(Default)] | 94 | #[derive(Default)] |
95 | struct LibrarySymbolsStats { | 95 | struct LibrarySymbolsStats { |
96 | total: usize, | 96 | total: usize, |
97 | fst_size: Bytes, | 97 | size: Bytes, |
98 | symbols_size: Bytes, | ||
99 | } | 98 | } |
100 | 99 | ||
101 | impl fmt::Display for LibrarySymbolsStats { | 100 | impl fmt::Display for LibrarySymbolsStats { |
102 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | 101 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
103 | write!( | 102 | write!(fmt, "{} ({}) symbols", self.total, self.size,) |
104 | fmt, | ||
105 | "{} ({} + {}) symbols", | ||
106 | self.total, self.fst_size, self.symbols_size | ||
107 | ) | ||
108 | } | 103 | } |
109 | } | 104 | } |
110 | 105 | ||
@@ -117,8 +112,7 @@ impl FromIterator<TableEntry<SourceRootId, Arc<SymbolIndex>>> for LibrarySymbols | |||
117 | for entry in iter { | 112 | for entry in iter { |
118 | let value = entry.value.unwrap(); | 113 | let value = entry.value.unwrap(); |
119 | res.total += value.len(); | 114 | res.total += value.len(); |
120 | res.fst_size += value.fst_size(); | 115 | res.size += value.memory_size(); |
121 | res.symbols_size += value.symbols_size(); | ||
122 | } | 116 | } |
123 | res | 117 | res |
124 | } | 118 | } |
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs index 69a669b8d..6baeabde6 100644 --- a/crates/ra_ide_api/src/symbol_index.rs +++ b/crates/ra_ide_api/src/symbol_index.rs | |||
@@ -137,12 +137,8 @@ impl SymbolIndex { | |||
137 | self.symbols.len() | 137 | self.symbols.len() |
138 | } | 138 | } |
139 | 139 | ||
140 | pub(crate) fn fst_size(&self) -> usize { | 140 | pub(crate) fn memory_size(&self) -> usize { |
141 | self.map.as_fst().size() | 141 | self.map.as_fst().size() * self.symbols.len() * mem::size_of::<FileSymbol>() |
142 | } | ||
143 | |||
144 | pub(crate) fn symbols_size(&self) -> usize { | ||
145 | self.symbols.len() * mem::size_of::<FileSymbol>() | ||
146 | } | 142 | } |
147 | 143 | ||
148 | pub(crate) fn for_files( | 144 | pub(crate) fn for_files( |