print one size for symbols

This commit is contained in:
Aleksey Kladov 2019-01-25 21:10:28 +03:00
parent aae69bc897
commit 50a7598773
2 changed files with 5 additions and 15 deletions

View File

@ -94,17 +94,12 @@ impl FromIterator<TableEntry<FileId, TreeArc<SourceFile>>> for SyntaxTreeStats {
#[derive(Default)] #[derive(Default)]
struct LibrarySymbolsStats { struct LibrarySymbolsStats {
total: usize, total: usize,
fst_size: Bytes, size: Bytes,
symbols_size: Bytes,
} }
impl fmt::Display for LibrarySymbolsStats { impl fmt::Display for LibrarySymbolsStats {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!( write!(fmt, "{} ({}) symbols", self.total, self.size,)
fmt,
"{} ({} + {}) symbols",
self.total, self.fst_size, self.symbols_size
)
} }
} }
@ -117,8 +112,7 @@ impl FromIterator<TableEntry<SourceRootId, Arc<SymbolIndex>>> for LibrarySymbols
for entry in iter { for entry in iter {
let value = entry.value.unwrap(); let value = entry.value.unwrap();
res.total += value.len(); res.total += value.len();
res.fst_size += value.fst_size(); res.size += value.memory_size();
res.symbols_size += value.symbols_size();
} }
res res
} }

View File

@ -137,12 +137,8 @@ impl SymbolIndex {
self.symbols.len() self.symbols.len()
} }
pub(crate) fn fst_size(&self) -> usize { pub(crate) fn memory_size(&self) -> usize {
self.map.as_fst().size() self.map.as_fst().size() * self.symbols.len() * mem::size_of::<FileSymbol>()
}
pub(crate) fn symbols_size(&self) -> usize {
self.symbols.len() * mem::size_of::<FileSymbol>()
} }
pub(crate) fn for_files( pub(crate) fn for_files(