Add profiling around add_impl_members

This intention is pretty slow for `impl Interator`, because it has a
ton of default methods which need to be substituted.

The proper fix here is to not compute the actual edit until the user
triggers the action, but that's awkward to do in the LSP right now, so
let's just put a profiling code for now.
This commit is contained in:
Aleksey Kladov 2020-02-06 14:55:10 +01:00
parent ea9d18ba83
commit ec6fb8da7c
3 changed files with 3 additions and 0 deletions

1
Cargo.lock generated
View file

@ -963,6 +963,7 @@ dependencies = [
"ra_db",
"ra_fmt",
"ra_hir",
"ra_prof",
"ra_syntax",
"ra_text_edit",
"rustc-hash",

View file

@ -16,6 +16,7 @@ either = "1.5"
ra_syntax = { path = "../ra_syntax" }
ra_text_edit = { path = "../ra_text_edit" }
ra_fmt = { path = "../ra_fmt" }
ra_prof = { path = "../ra_prof" }
ra_db = { path = "../ra_db" }
hir = { path = "../ra_hir", package = "ra_hir" }
test_utils = { path = "../test_utils" }

View file

@ -99,6 +99,7 @@ fn add_missing_impl_members_inner(
assist_id: &'static str,
label: &'static str,
) -> Option<Assist> {
let _p = ra_prof::profile("add_missing_impl_members_inner");
let impl_node = ctx.find_node_at_offset::<ast::ImplBlock>()?;
let impl_item_list = impl_node.item_list()?;