aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-24 08:37:52 +0100
committerGitHub <[email protected]>2019-10-24 08:37:52 +0100
commit018b621f613e87af26d8f7880ea1012cb374216c (patch)
treec2f9015026a295d17b792e917c1b42b09f933a57
parent778f50b1477ad3c33cd6220f71bac7b83a66176a (diff)
parentac1b7b07e770652bad72f024efebfd5790a509c3 (diff)
Merge #2057
2057: add some profiling calls r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_ide_api/src/references.rs3
-rw-r--r--crates/ra_ide_api/src/references/classify.rs4
-rw-r--r--crates/ra_ide_api/src/references/search_scope.rs3
3 files changed, 10 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs
index f35d835ac..8200bd1ef 100644
--- a/crates/ra_ide_api/src/references.rs
+++ b/crates/ra_ide_api/src/references.rs
@@ -16,6 +16,7 @@ mod search_scope;
16 16
17use once_cell::unsync::Lazy; 17use once_cell::unsync::Lazy;
18use ra_db::{SourceDatabase, SourceDatabaseExt}; 18use ra_db::{SourceDatabase, SourceDatabaseExt};
19use ra_prof::profile;
19use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit}; 20use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit};
20 21
21use crate::{db::RootDatabase, FilePosition, FileRange, NavigationTarget, RangeInfo}; 22use crate::{db::RootDatabase, FilePosition, FileRange, NavigationTarget, RangeInfo};
@@ -107,6 +108,8 @@ fn find_name<'a>(
107} 108}
108 109
109fn process_definition(db: &RootDatabase, def: NameDefinition, name: String) -> Vec<FileRange> { 110fn process_definition(db: &RootDatabase, def: NameDefinition, name: String) -> Vec<FileRange> {
111 let _p = profile("process_definition");
112
110 let pat = name.as_str(); 113 let pat = name.as_str();
111 let scope = def.search_scope(db); 114 let scope = def.search_scope(db);
112 let mut refs = vec![]; 115 let mut refs = vec![];
diff --git a/crates/ra_ide_api/src/references/classify.rs b/crates/ra_ide_api/src/references/classify.rs
index c8daff9b1..153082d5b 100644
--- a/crates/ra_ide_api/src/references/classify.rs
+++ b/crates/ra_ide_api/src/references/classify.rs
@@ -2,6 +2,7 @@
2 2
3use hir::{Either, FromSource, Module, ModuleSource, Path, PathResolution, Source, SourceAnalyzer}; 3use hir::{Either, FromSource, Module, ModuleSource, Path, PathResolution, Source, SourceAnalyzer};
4use ra_db::FileId; 4use ra_db::FileId;
5use ra_prof::profile;
5use ra_syntax::{ast, match_ast, AstNode, AstPtr}; 6use ra_syntax::{ast, match_ast, AstNode, AstPtr};
6use test_utils::tested_by; 7use test_utils::tested_by;
7 8
@@ -16,6 +17,7 @@ pub(crate) fn classify_name(
16 file_id: FileId, 17 file_id: FileId,
17 name: &ast::Name, 18 name: &ast::Name,
18) -> Option<NameDefinition> { 19) -> Option<NameDefinition> {
20 let _p = profile("classify_name");
19 let parent = name.syntax().parent()?; 21 let parent = name.syntax().parent()?;
20 let file_id = file_id.into(); 22 let file_id = file_id.into();
21 23
@@ -108,6 +110,8 @@ pub(crate) fn classify_name_ref(
108) -> Option<NameDefinition> { 110) -> Option<NameDefinition> {
109 use PathResolution::*; 111 use PathResolution::*;
110 112
113 let _p = profile("classify_name_ref");
114
111 let parent = name_ref.syntax().parent()?; 115 let parent = name_ref.syntax().parent()?;
112 let analyzer = SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); 116 let analyzer = SourceAnalyzer::new(db, file_id, name_ref.syntax(), None);
113 117
diff --git a/crates/ra_ide_api/src/references/search_scope.rs b/crates/ra_ide_api/src/references/search_scope.rs
index 5cb69b8fc..21e667c83 100644
--- a/crates/ra_ide_api/src/references/search_scope.rs
+++ b/crates/ra_ide_api/src/references/search_scope.rs
@@ -5,6 +5,7 @@
5 5
6use hir::{DefWithBody, HasSource, ModuleSource}; 6use hir::{DefWithBody, HasSource, ModuleSource};
7use ra_db::{FileId, SourceDatabase, SourceDatabaseExt}; 7use ra_db::{FileId, SourceDatabase, SourceDatabaseExt};
8use ra_prof::profile;
8use ra_syntax::{AstNode, TextRange}; 9use ra_syntax::{AstNode, TextRange};
9use rustc_hash::FxHashSet; 10use rustc_hash::FxHashSet;
10 11
@@ -14,6 +15,8 @@ use super::{NameDefinition, NameKind};
14 15
15impl NameDefinition { 16impl NameDefinition {
16 pub(crate) fn search_scope(&self, db: &RootDatabase) -> FxHashSet<(FileId, Option<TextRange>)> { 17 pub(crate) fn search_scope(&self, db: &RootDatabase) -> FxHashSet<(FileId, Option<TextRange>)> {
18 let _p = profile("search_scope");
19
17 let module_src = self.container.definition_source(db); 20 let module_src = self.container.definition_source(db);
18 let file_id = module_src.file_id.original_file(db); 21 let file_id = module_src.file_id.original_file(db);
19 22