From 50a7598773eaa57379d81c3d917ab4c84d867a51 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 25 Jan 2019 21:10:28 +0300 Subject: print one size for symbols --- crates/ra_ide_api/src/status.rs | 12 +++--------- 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>> for SyntaxTreeStats { #[derive(Default)] struct LibrarySymbolsStats { total: usize, - fst_size: Bytes, - symbols_size: Bytes, + size: Bytes, } impl fmt::Display for LibrarySymbolsStats { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!( - fmt, - "{} ({} + {}) symbols", - self.total, self.fst_size, self.symbols_size - ) + write!(fmt, "{} ({}) symbols", self.total, self.size,) } } @@ -117,8 +112,7 @@ impl FromIterator>> for LibrarySymbols for entry in iter { let value = entry.value.unwrap(); res.total += value.len(); - res.fst_size += value.fst_size(); - res.symbols_size += value.symbols_size(); + res.size += value.memory_size(); } res } 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 { self.symbols.len() } - pub(crate) fn fst_size(&self) -> usize { - self.map.as_fst().size() - } - - pub(crate) fn symbols_size(&self) -> usize { - self.symbols.len() * mem::size_of::() + pub(crate) fn memory_size(&self) -> usize { + self.map.as_fst().size() * self.symbols.len() * mem::size_of::() } pub(crate) fn for_files( -- cgit v1.2.3