diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-03 10:09:11 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-03 10:09:11 +0100 |
commit | c6c88070c4f25cd3710f03b7461cb277de8d3cc5 (patch) | |
tree | cfe6ec2fb43dcfb9a7f1c5698aaac0d17b2bf78a /crates/ra_hir/src | |
parent | b8e58d4a2f317fe300f13416858f33e860138c4d (diff) | |
parent | b74449e9952846a8ea66c3507e52c24348d6dbc9 (diff) |
Merge #1068
1068: profiling crate first draft r=matklad a=pasa
I've made this first draft for #961
Could you look at it? Is this something what you are looking for?
It has lack of tests. I can't figure out how to test stderr output in rust right now. Do you have some clues?
Additionally I'm thinking about to implement procedural macros to annotate methods with this profiler. Will it be helpful?
Co-authored-by: Sergey Parilin <[email protected]>
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/nameres.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs index 6f049acfc..4ae04514a 100644 --- a/crates/ra_hir/src/nameres.rs +++ b/crates/ra_hir/src/nameres.rs | |||
@@ -60,6 +60,7 @@ use ra_arena::{Arena, RawId, impl_arena_id}; | |||
60 | use ra_db::{FileId, Edition}; | 60 | use ra_db::{FileId, Edition}; |
61 | use test_utils::tested_by; | 61 | use test_utils::tested_by; |
62 | use ra_syntax::ast; | 62 | use ra_syntax::ast; |
63 | use ra_prof::profile; | ||
63 | 64 | ||
64 | use crate::{ | 65 | use crate::{ |
65 | ModuleDef, Name, Crate, Module, | 66 | ModuleDef, Name, Crate, Module, |
@@ -181,7 +182,7 @@ enum ReachedFixedPoint { | |||
181 | 182 | ||
182 | impl CrateDefMap { | 183 | impl CrateDefMap { |
183 | pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: Crate) -> Arc<CrateDefMap> { | 184 | pub(crate) fn crate_def_map_query(db: &impl DefDatabase, krate: Crate) -> Arc<CrateDefMap> { |
184 | let start = std::time::Instant::now(); | 185 | let _p = profile("crate_def_map_query"); |
185 | let def_map = { | 186 | let def_map = { |
186 | let edition = krate.edition(db); | 187 | let edition = krate.edition(db); |
187 | let mut modules: Arena<CrateModuleId, ModuleData> = Arena::default(); | 188 | let mut modules: Arena<CrateModuleId, ModuleData> = Arena::default(); |
@@ -198,7 +199,6 @@ impl CrateDefMap { | |||
198 | } | 199 | } |
199 | }; | 200 | }; |
200 | let def_map = collector::collect_defs(db, def_map); | 201 | let def_map = collector::collect_defs(db, def_map); |
201 | log::info!("crate_def_map_query: {:?}", start.elapsed()); | ||
202 | Arc::new(def_map) | 202 | Arc::new(def_map) |
203 | } | 203 | } |
204 | 204 | ||