From 0f3e85002b74b45ac7862ccf7fe72650f59d679d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 21 May 2019 16:04:17 +0300 Subject: profile implements query --- crates/ra_hir/src/ty/traits.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'crates') diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index 190d018ff..f39749cab 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs @@ -4,6 +4,7 @@ use std::sync::{Arc, Mutex}; use rustc_hash::FxHashSet; use log::debug; use chalk_ir::cast::Cast; +use ra_prof::profile; use crate::{Crate, Trait, db::HirDatabase, ImplBlock}; use super::{TraitRef, Ty, Canonical}; @@ -81,6 +82,7 @@ pub(crate) fn implements_query( krate: Crate, trait_ref: Canonical, ) -> Option { + let _p = profile("implements_query"); let goal: chalk_ir::Goal = trait_ref.value.to_chalk(db).cast(); debug!("goal: {:?}", goal); let env = chalk_ir::Environment::new(); -- cgit v1.2.3 From f63be060027cf25ce1c64bd02dab2931fc1ceafe Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 21 May 2019 16:24:53 +0300 Subject: profile type inference --- crates/ra_hir/src/db.rs | 2 +- crates/ra_hir/src/ty.rs | 2 +- crates/ra_hir/src/ty/infer.rs | 4 +++- crates/ra_prof/src/lib.rs | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index da62db58a..11cdf9c34 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs @@ -126,7 +126,7 @@ pub trait HirDatabase: DefDatabase { #[salsa::invoke(ExprScopes::expr_scopes_query)] fn expr_scopes(&self, def: DefWithBody) -> Arc; - #[salsa::invoke(crate::ty::infer)] + #[salsa::invoke(crate::ty::infer_query)] fn infer(&self, def: DefWithBody) -> Arc; #[salsa::invoke(crate::ty::type_for_def)] diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 9a65bf567..3679a2242 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs @@ -20,7 +20,7 @@ use crate::{Name, AdtDef, type_ref::Mutability, db::HirDatabase, Trait, GenericP use display::{HirDisplay, HirFormatter}; pub(crate) use lower::{TypableDef, type_for_def, type_for_field, callable_item_sig, generic_predicates, generic_defaults}; -pub(crate) use infer::{infer, InferenceResult, InferTy}; +pub(crate) use infer::{infer_query, InferenceResult, InferTy}; pub use lower::CallableDef; /// A type constructor or type name: this might be something like the primitive diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 1e7d97f51..a48272981 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs @@ -23,6 +23,7 @@ use ena::unify::{InPlaceUnificationTable, UnifyKey, UnifyValue, NoError}; use rustc_hash::FxHashMap; use ra_arena::map::ArenaMap; +use ra_prof::profile; use test_utils::tested_by; use crate::{ @@ -51,7 +52,8 @@ use super::{ mod unify; /// The entry point of type inference. -pub fn infer(db: &impl HirDatabase, def: DefWithBody) -> Arc { +pub fn infer_query(db: &impl HirDatabase, def: DefWithBody) -> Arc { + let _p = profile("infer_query"); db.check_canceled(); let body = def.body(db); let resolver = def.resolver(db); diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index e56446c9f..61f2226d7 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs @@ -198,6 +198,7 @@ fn print(lvl: usize, msgs: &[Message], out: &mut impl Write) { if l != lvl { continue; } + writeln!(out, "{} {:6}ms - {}", indent, dur.as_millis(), msg) .expect("printing profiling info to stdout"); -- cgit v1.2.3