Skip to content

Commit

Permalink
Add a profile call when calling db.crate_def_map
Browse files Browse the repository at this point in the history
Example output:

```
  244ms - handle_inlay_hints
      162ms - get_inlay_hints
          162ms - SourceAnalyzer::new
               69ms - def_with_body_from_child_node
                   69ms - analyze_container
                       69ms - analyze_container
                           69ms - Module::from_definition
                               69ms - Module::from_file
                                   69ms - db.crate_def_map
                                        0ms - parse_macro_query (6 calls)
                                        0ms - raw_items_query (1 calls)
                                       69ms - ???
```

The interesting thing is that `crate_def_map_query` is not even called
and spot-checking the dependencies, it seems that all of the
query-functions already do call `profile` themselves. Is all this time
spent in salsa itself? (checking if recomputation is needed)

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
  • Loading branch information
michalt committed Jan 3, 2020
1 parent 4516c4c commit 57dee14
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/ra_hir/src/from_source.rs
Expand Up @@ -213,7 +213,10 @@ impl Module {
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 = {
let _p = profile("db.crate_def_map");
db.crate_def_map(crate_id)
};
let local_id = crate_def_map.modules_for_file(file).next()?;
Some((crate_id, local_id))
})?;
Expand Down

0 comments on commit 57dee14

Please sign in to comment.