From 8f032d6a585d59a9d2e57beeaca903a4fb5eb57b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 19 Jul 2019 19:53:42 +0300 Subject: drop memory size of subtree it wasn't too accurate and the new measurement method of dropping the database completely is better anyway --- crates/ra_ide_api/src/status.rs | 15 ++++----------- crates/ra_syntax/src/syntax_node.rs | 4 ---- 2 files changed, 4 insertions(+), 15 deletions(-) (limited to 'crates') diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs index d533d1742..c037e496d 100644 --- a/crates/ra_ide_api/src/status.rs +++ b/crates/ra_ide_api/src/status.rs @@ -9,7 +9,7 @@ use ra_db::{ FileTextQuery, SourceRootId, }; use ra_prof::{memory_usage, Bytes}; -use ra_syntax::{ast, AstNode, Parse, SyntaxNode}; +use ra_syntax::{ast, Parse, SyntaxNode}; use crate::{ db::RootDatabase, @@ -70,12 +70,11 @@ impl FromIterator>> for FilesStats { pub(crate) struct SyntaxTreeStats { total: usize, pub(crate) retained: usize, - retained_size: Bytes, } impl fmt::Display for SyntaxTreeStats { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - write!(fmt, "{} trees, {} ({}) retained", self.total, self.retained, self.retained_size,) + write!(fmt, "{} trees, {} retained", self.total, self.retained) } } @@ -87,10 +86,7 @@ impl FromIterator>> for SyntaxTreeStat let mut res = SyntaxTreeStats::default(); for entry in iter { res.total += 1; - if let Some(tree) = entry.value.as_ref().map(|it| it.tree()) { - res.retained += 1; - res.retained_size += tree.syntax().memory_size_of_subtree(); - } + res.retained += entry.value.is_some() as usize; } res } @@ -104,10 +100,7 @@ impl FromIterator>>> for SyntaxTr let mut res = SyntaxTreeStats::default(); for entry in iter { res.total += 1; - if let Some(tree) = entry.value.and_then(|it| it).map(|it| it.syntax_node()) { - res.retained += 1; - res.retained_size += tree.memory_size_of_subtree(); - } + res.retained += entry.value.is_some() as usize; } res } diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs index 98955832b..62e0967b7 100644 --- a/crates/ra_syntax/src/syntax_node.rs +++ b/crates/ra_syntax/src/syntax_node.rs @@ -173,10 +173,6 @@ impl SyntaxNode { }) } - pub fn memory_size_of_subtree(&self) -> usize { - 0 - } - pub fn debug_dump(&self) -> String { let mut level = 0; let mut buf = String::new(); -- cgit v1.2.3