aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide_api/src/status.rs15
-rw-r--r--crates/ra_syntax/src/syntax_node.rs4
2 files changed, 4 insertions, 15 deletions
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::{
9 FileTextQuery, SourceRootId, 9 FileTextQuery, SourceRootId,
10}; 10};
11use ra_prof::{memory_usage, Bytes}; 11use ra_prof::{memory_usage, Bytes};
12use ra_syntax::{ast, AstNode, Parse, SyntaxNode}; 12use ra_syntax::{ast, Parse, SyntaxNode};
13 13
14use crate::{ 14use crate::{
15 db::RootDatabase, 15 db::RootDatabase,
@@ -70,12 +70,11 @@ impl FromIterator<TableEntry<FileId, Arc<String>>> for FilesStats {
70pub(crate) struct SyntaxTreeStats { 70pub(crate) struct SyntaxTreeStats {
71 total: usize, 71 total: usize,
72 pub(crate) retained: usize, 72 pub(crate) retained: usize,
73 retained_size: Bytes,
74} 73}
75 74
76impl fmt::Display for SyntaxTreeStats { 75impl fmt::Display for SyntaxTreeStats {
77 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { 76 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
78 write!(fmt, "{} trees, {} ({}) retained", self.total, self.retained, self.retained_size,) 77 write!(fmt, "{} trees, {} retained", self.total, self.retained)
79 } 78 }
80} 79}
81 80
@@ -87,10 +86,7 @@ impl FromIterator<TableEntry<FileId, Parse<ast::SourceFile>>> for SyntaxTreeStat
87 let mut res = SyntaxTreeStats::default(); 86 let mut res = SyntaxTreeStats::default();
88 for entry in iter { 87 for entry in iter {
89 res.total += 1; 88 res.total += 1;
90 if let Some(tree) = entry.value.as_ref().map(|it| it.tree()) { 89 res.retained += entry.value.is_some() as usize;
91 res.retained += 1;
92 res.retained_size += tree.syntax().memory_size_of_subtree();
93 }
94 } 90 }
95 res 91 res
96 } 92 }
@@ -104,10 +100,7 @@ impl FromIterator<TableEntry<MacroFile, Option<Parse<SyntaxNode>>>> for SyntaxTr
104 let mut res = SyntaxTreeStats::default(); 100 let mut res = SyntaxTreeStats::default();
105 for entry in iter { 101 for entry in iter {
106 res.total += 1; 102 res.total += 1;
107 if let Some(tree) = entry.value.and_then(|it| it).map(|it| it.syntax_node()) { 103 res.retained += entry.value.is_some() as usize;
108 res.retained += 1;
109 res.retained_size += tree.memory_size_of_subtree();
110 }
111 } 104 }
112 res 105 res
113 } 106 }
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 {
173 }) 173 })
174 } 174 }
175 175
176 pub fn memory_size_of_subtree(&self) -> usize {
177 0
178 }
179
180 pub fn debug_dump(&self) -> String { 176 pub fn debug_dump(&self) -> String {
181 let mut level = 0; 177 let mut level = 0;
182 let mut buf = String::new(); 178 let mut buf = String::new();