aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-25 18:10:28 +0000
committerAleksey Kladov <[email protected]>2019-01-25 18:10:51 +0000
commit50a7598773eaa57379d81c3d917ab4c84d867a51 (patch)
tree0fcebddad60a74709e0f98cb565e7c15b967dfaf /crates
parentaae69bc897f3ede3e2fecf3c9e7e24d9e254497c (diff)
print one size for symbols
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_api/src/status.rs12
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs8
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)]
95struct LibrarySymbolsStats { 95struct LibrarySymbolsStats {
96 total: usize, 96 total: usize,
97 fst_size: Bytes, 97 size: Bytes,
98 symbols_size: Bytes,
99} 98}
100 99
101impl fmt::Display for LibrarySymbolsStats { 100impl 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(