aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-01-03 11:57:11 +0000
committerGitHub <[email protected]>2020-01-03 11:57:11 +0000
commite423cfe383a4a1f9f0b5459810587d50bf2a2b2d (patch)
treed7d43e3f325f6055d5806303906ed0876af1966a /crates
parent1cb8aa1311668b710379158762cab9ee03a92925 (diff)
parent100c2d01272b341b85b948da068d944b9af23ad0 (diff)
Merge #2730
2730: Add `profile` calls to {Module,Function}::diagnostics r=matklad a=michalt With this change the output `ra_prof` gives a better indication where the time is spent. Example output: ``` 213ms - publish_diagnostics 213ms - diagnostics 70ms - Module::from_definition 70ms - Module::from_file 132ms - Module::diagnostics 78ms - Function::diagnostics 0ms - body_with_source_map_query (1 calls) 2ms - trait_solve_query (1 calls) 76ms - ??? 15ms - Function::diagnostics 0ms - body_with_source_map_query (1 calls) 15ms - trait_solve_query (5 calls) 38ms - Function::diagnostics (51 calls) 8ms - parse_query (1 calls) ``` Signed-off-by: Michal Terepeta <[email protected]> Co-authored-by: Michal Terepeta <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/code_model.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 488f74cfb..cc42068a1 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -25,6 +25,7 @@ use hir_ty::{
25 TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk, 25 TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk,
26}; 26};
27use ra_db::{CrateId, Edition, FileId}; 27use ra_db::{CrateId, Edition, FileId};
28use ra_prof::profile;
28use ra_syntax::ast; 29use ra_syntax::ast;
29 30
30use crate::{ 31use crate::{
@@ -189,6 +190,7 @@ impl Module {
189 } 190 }
190 191
191 pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { 192 pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) {
193 let _p = profile("Module::diagnostics");
192 db.crate_def_map(self.id.krate).add_diagnostics(db, self.id.local_id, sink); 194 db.crate_def_map(self.id.krate).add_diagnostics(db, self.id.local_id, sink);
193 for decl in self.declarations(db) { 195 for decl in self.declarations(db) {
194 match decl { 196 match decl {
@@ -507,6 +509,7 @@ impl Function {
507 } 509 }
508 510
509 pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { 511 pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) {
512 let _p = profile("Function::diagnostics");
510 let infer = db.infer(self.id.into()); 513 let infer = db.infer(self.id.into());
511 infer.add_diagnostics(db, self.id, sink); 514 infer.add_diagnostics(db, self.id, sink);
512 let mut validator = ExprValidator::new(self.id, infer, sink); 515 let mut validator = ExprValidator::new(self.id, infer, sink);