From 4d4ac1d4fa0aba107a27d3fd2d209304dfe69b9f Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 1 Mar 2021 14:27:07 +0200 Subject: Profile import_assets better --- crates/ide_db/src/helpers/import_assets.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/ide_db/src') diff --git a/crates/ide_db/src/helpers/import_assets.rs b/crates/ide_db/src/helpers/import_assets.rs index 4e352d546..a30a4dd9d 100644 --- a/crates/ide_db/src/helpers/import_assets.rs +++ b/crates/ide_db/src/helpers/import_assets.rs @@ -244,6 +244,7 @@ impl<'a> ImportAssets<'a> { prefixed: Option, defs_for_candidate_name: impl Iterator>, ) -> FxHashSet { + let _p = profile::span("import_assets::applicable_defs"); let current_crate = self.module_with_candidate.krate(); let mod_path = |item| get_mod_path(db, item, &self.module_with_candidate, prefixed); @@ -278,6 +279,8 @@ fn path_applicable_imports( mod_path: impl Fn(ItemInNs) -> Option + Copy, defs_for_candidate_name: impl Iterator>, ) -> FxHashSet { + let _p = profile::span("import_assets::path_applicable_imports"); + let items_for_candidate_name = defs_for_candidate_name.map(|def| def.either(ItemInNs::from, ItemInNs::from)); @@ -306,6 +309,7 @@ fn import_for_item( unresolved_qualifier: &str, original_item: ItemInNs, ) -> Option { + let _p = profile::span("import_assets::import_for_item"); let (item_candidate, trait_to_import) = match original_item.as_module_def_id() { Some(module_def_id) => { match ModuleDef::from(module_def_id).as_assoc_item(db).map(|assoc| assoc.container(db)) @@ -397,6 +401,7 @@ fn trait_applicable_items( mod_path: impl Fn(ItemInNs) -> Option, defs_for_candidate_name: impl Iterator>, ) -> FxHashSet { + let _p = profile::span("import_assets::trait_applicable_items"); let mut required_assoc_items = FxHashSet::default(); let trait_candidates = defs_for_candidate_name -- cgit v1.2.3