diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-19 17:56:24 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-19 17:56:24 +0100 |
commit | d4ffbf2ae092b313b3c750adad398f3aa6fb209b (patch) | |
tree | 10d30f6688ffeb68827768b7c1790a198085faa9 /crates | |
parent | f697d27c31ba4486b9711893a93505a05319a2dc (diff) | |
parent | 8f032d6a585d59a9d2e57beeaca903a4fb5eb57b (diff) |
Merge #1555
1555: drop memory size of subtree r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide_api/src/status.rs | 15 | ||||
-rw-r--r-- | crates/ra_syntax/src/syntax_node.rs | 4 |
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 | }; |
11 | use ra_prof::{memory_usage, Bytes}; | 11 | use ra_prof::{memory_usage, Bytes}; |
12 | use ra_syntax::{ast, AstNode, Parse, SyntaxNode}; | 12 | use ra_syntax::{ast, Parse, SyntaxNode}; |
13 | 13 | ||
14 | use crate::{ | 14 | use crate::{ |
15 | db::RootDatabase, | 15 | db::RootDatabase, |
@@ -70,12 +70,11 @@ impl FromIterator<TableEntry<FileId, Arc<String>>> for FilesStats { | |||
70 | pub(crate) struct SyntaxTreeStats { | 70 | pub(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 | ||
76 | impl fmt::Display for SyntaxTreeStats { | 75 | impl 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(); |