diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-01 20:32:02 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-06-01 20:32:02 +0100 |
commit | 35739232793e7032e03aa2a1944a0e4e25e771d6 (patch) | |
tree | 8d9e40d172162cf6c183e3d383070c9798cf6e54 /crates/ra_ide_api/src | |
parent | ccec71165bf1f8f79bd2d2a5c05bed55ff3a07a2 (diff) | |
parent | f7d3a873050fb8360b663ca281a805de8cf7f30d (diff) |
Merge #1363
1363: some work on memory r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/change.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/status.rs | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs index 4b597afc0..445a94aa8 100644 --- a/crates/ra_ide_api/src/change.rs +++ b/crates/ra_ide_api/src/change.rs | |||
@@ -228,9 +228,9 @@ impl RootDatabase { | |||
228 | 228 | ||
229 | self.query(hir::db::ParseOrExpandQuery).sweep(sweep); | 229 | self.query(hir::db::ParseOrExpandQuery).sweep(sweep); |
230 | self.query(hir::db::AstIdMapQuery).sweep(sweep); | 230 | self.query(hir::db::AstIdMapQuery).sweep(sweep); |
231 | self.query(hir::db::AstIdToNodeQuery).sweep(sweep); | ||
232 | 231 | ||
233 | self.query(hir::db::RawItemsWithSourceMapQuery).sweep(sweep); | 232 | self.query(hir::db::RawItemsWithSourceMapQuery).sweep(sweep); |
233 | self.query(hir::db::ImplsInModuleWithSourceMapQuery).sweep(sweep); | ||
234 | self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); | 234 | self.query(hir::db::BodyWithSourceMapQuery).sweep(sweep); |
235 | } | 235 | } |
236 | } | 236 | } |
diff --git a/crates/ra_ide_api/src/status.rs b/crates/ra_ide_api/src/status.rs index 821106fea..822279812 100644 --- a/crates/ra_ide_api/src/status.rs +++ b/crates/ra_ide_api/src/status.rs | |||
@@ -4,11 +4,12 @@ use std::{ | |||
4 | sync::Arc, | 4 | sync::Arc, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | use ra_syntax::{AstNode, Parse}; | 7 | use ra_syntax::{TreeArc, SyntaxNode}; |
8 | use ra_db::{ | 8 | use ra_db::{ |
9 | ParseQuery, FileTextQuery, SourceRootId, | 9 | FileTextQuery, SourceRootId, |
10 | salsa::{Database, debug::{DebugQueryTable, TableEntry}}, | 10 | salsa::{Database, debug::{DebugQueryTable, TableEntry}}, |
11 | }; | 11 | }; |
12 | use hir::HirFileId; | ||
12 | 13 | ||
13 | use crate::{ | 14 | use crate::{ |
14 | FileId, db::RootDatabase, | 15 | FileId, db::RootDatabase, |
@@ -16,7 +17,7 @@ use crate::{ | |||
16 | }; | 17 | }; |
17 | 18 | ||
18 | pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { | 19 | pub(crate) fn syntax_tree_stats(db: &RootDatabase) -> SyntaxTreeStats { |
19 | db.query(ParseQuery).entries::<SyntaxTreeStats>() | 20 | db.query(hir::db::ParseOrExpandQuery).entries::<SyntaxTreeStats>() |
20 | } | 21 | } |
21 | 22 | ||
22 | pub(crate) fn status(db: &RootDatabase) -> String { | 23 | pub(crate) fn status(db: &RootDatabase) -> String { |
@@ -72,17 +73,17 @@ impl fmt::Display for SyntaxTreeStats { | |||
72 | } | 73 | } |
73 | } | 74 | } |
74 | 75 | ||
75 | impl FromIterator<TableEntry<FileId, Parse>> for SyntaxTreeStats { | 76 | impl FromIterator<TableEntry<HirFileId, Option<TreeArc<SyntaxNode>>>> for SyntaxTreeStats { |
76 | fn from_iter<T>(iter: T) -> SyntaxTreeStats | 77 | fn from_iter<T>(iter: T) -> SyntaxTreeStats |
77 | where | 78 | where |
78 | T: IntoIterator<Item = TableEntry<FileId, Parse>>, | 79 | T: IntoIterator<Item = TableEntry<HirFileId, Option<TreeArc<SyntaxNode>>>>, |
79 | { | 80 | { |
80 | let mut res = SyntaxTreeStats::default(); | 81 | let mut res = SyntaxTreeStats::default(); |
81 | for entry in iter { | 82 | for entry in iter { |
82 | res.total += 1; | 83 | res.total += 1; |
83 | if let Some(value) = entry.value { | 84 | if let Some(tree) = entry.value.and_then(|it| it) { |
84 | res.retained += 1; | 85 | res.retained += 1; |
85 | res.retained_size += value.tree.syntax().memory_size_of_subtree(); | 86 | res.retained_size += tree.memory_size_of_subtree(); |
86 | } | 87 | } |
87 | } | 88 | } |
88 | res | 89 | res |