3931: profile queries r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-04-10 18:27:12 +00:00 committed by GitHub
commit 773bb5173d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@
//! features, such as Fn family of traits.
use std::sync::Arc;
use ra_prof::profile;
use ra_syntax::SmolStr;
use rustc_hash::FxHashMap;
@ -78,6 +79,8 @@ impl LangItems {
/// Salsa query. This will look for lang items in a specific crate.
pub(crate) fn crate_lang_items_query(db: &dyn DefDatabase, krate: CrateId) -> Arc<LangItems> {
let _p = profile("crate_lang_items_query");
let mut lang_items = LangItems::default();
let crate_def_map = db.crate_def_map(krate);
@ -95,6 +98,7 @@ impl LangItems {
db: &dyn DefDatabase,
module: ModuleId,
) -> Option<Arc<LangItems>> {
let _p = profile("module_lang_items_query");
let mut lang_items = LangItems::default();
lang_items.collect_lang_items(db, module);
if lang_items.items.is_empty() {
@ -111,6 +115,7 @@ impl LangItems {
start_crate: CrateId,
item: SmolStr,
) -> Option<LangItemTarget> {
let _p = profile("lang_item_query");
let lang_items = db.crate_lang_items(start_crate);
let start_crate_target = lang_items.items.get(&item);
if let Some(target) = start_crate_target {