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)]
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<TableEntry<SourceRootId, Arc<SymbolIndex>>> 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
}

View File

@ -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::<FileSymbol>()
pub(crate) fn memory_size(&self) -> usize {
self.map.as_fst().size() * self.symbols.len() * mem::size_of::<FileSymbol>()
}
pub(crate) fn for_files(