mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
More profiling
This commit is contained in:
parent
f874d6c475
commit
e903f58d29
3 changed files with 11 additions and 2 deletions
|
@ -7,6 +7,7 @@ use hir_def::{
|
||||||
StaticId, StructId, TraitId, TypeAliasId, UnionId, VariantId,
|
StaticId, StructId, TraitId, TypeAliasId, UnionId, VariantId,
|
||||||
};
|
};
|
||||||
use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind};
|
use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind};
|
||||||
|
use ra_db::FileId;
|
||||||
use ra_prof::profile;
|
use ra_prof::profile;
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
ast::{self, AstNode, NameOwner},
|
ast::{self, AstNode, NameOwner},
|
||||||
|
@ -206,10 +207,14 @@ impl Module {
|
||||||
};
|
};
|
||||||
|
|
||||||
let original_file = src.file_id.original_file(db);
|
let original_file = src.file_id.original_file(db);
|
||||||
|
Module::from_file(db, original_file)
|
||||||
|
}
|
||||||
|
|
||||||
let (krate, local_id) = db.relevant_crates(original_file).iter().find_map(|&crate_id| {
|
fn from_file(db: &impl DefDatabase, file: FileId) -> Option<Self> {
|
||||||
|
let _p = profile("Module::from_file");
|
||||||
|
let (krate, local_id) = db.relevant_crates(file).iter().find_map(|&crate_id| {
|
||||||
let crate_def_map = db.crate_def_map(crate_id);
|
let crate_def_map = db.crate_def_map(crate_id);
|
||||||
let local_id = crate_def_map.modules_for_file(original_file).next()?;
|
let local_id = crate_def_map.modules_for_file(file).next()?;
|
||||||
Some((crate_id, local_id))
|
Some((crate_id, local_id))
|
||||||
})?;
|
})?;
|
||||||
Some(Module { id: ModuleId { krate, local_id } })
|
Some(Module { id: ModuleId { krate, local_id } })
|
||||||
|
|
|
@ -8,6 +8,7 @@ use hir_expand::{
|
||||||
InFile,
|
InFile,
|
||||||
};
|
};
|
||||||
use ra_arena::{map::ArenaMap, Arena};
|
use ra_arena::{map::ArenaMap, Arena};
|
||||||
|
use ra_prof::profile;
|
||||||
use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
|
use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -72,6 +73,7 @@ impl StructData {
|
||||||
|
|
||||||
impl EnumData {
|
impl EnumData {
|
||||||
pub(crate) fn enum_data_query(db: &impl DefDatabase, e: EnumId) -> Arc<EnumData> {
|
pub(crate) fn enum_data_query(db: &impl DefDatabase, e: EnumId) -> Arc<EnumData> {
|
||||||
|
let _p = profile("enum_data_query");
|
||||||
let src = e.lookup(db).source(db);
|
let src = e.lookup(db).source(db);
|
||||||
let name = src.value.name().map_or_else(Name::missing, |n| n.as_name());
|
let name = src.value.name().map_or_else(Name::missing, |n| n.as_name());
|
||||||
let mut trace = Trace::new_for_arena();
|
let mut trace = Trace::new_for_arena();
|
||||||
|
|
|
@ -14,6 +14,7 @@ use hir_expand::{
|
||||||
name::{AsName, Name},
|
name::{AsName, Name},
|
||||||
};
|
};
|
||||||
use ra_arena::{impl_arena_id, Arena, RawId};
|
use ra_arena::{impl_arena_id, Arena, RawId};
|
||||||
|
use ra_prof::profile;
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
ast::{self, AttrsOwner, NameOwner},
|
ast::{self, AttrsOwner, NameOwner},
|
||||||
AstNode,
|
AstNode,
|
||||||
|
@ -42,6 +43,7 @@ impl RawItems {
|
||||||
db: &(impl DefDatabase + AstDatabase),
|
db: &(impl DefDatabase + AstDatabase),
|
||||||
file_id: HirFileId,
|
file_id: HirFileId,
|
||||||
) -> Arc<RawItems> {
|
) -> Arc<RawItems> {
|
||||||
|
let _p = profile("raw_items_query");
|
||||||
let mut collector = RawItemsCollector {
|
let mut collector = RawItemsCollector {
|
||||||
raw_items: RawItems::default(),
|
raw_items: RawItems::default(),
|
||||||
source_ast_id_map: db.ast_id_map(file_id),
|
source_ast_id_map: db.ast_id_map(file_id),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue