Stream: t-compiler/wg-rls-2.0

Topic: slow?


Laurențiu Nicola (Feb 17 2020 at 19:25, on Zulip):

Just checking, is this normal?

 1120ms - LibraryData::prepare
 1372ms - LibraryData::prepare
 1469ms - LibraryData::prepare
 1507ms - LibraryData::prepare
 1685ms - LibraryData::prepare
 2510ms - LibraryData::prepare
 1023ms - LibraryData::prepare
 1497ms - LibraryData::prepare
 1604ms - LibraryData::prepare
 2241ms - LibraryData::prepare
 2281ms - LibraryData::prepare
 3578ms - LibraryData::prepare
 2320ms - LibraryData::prepare
 4202ms - LibraryData::prepare
 1034ms - LibraryData::prepare
 1654ms - LibraryData::prepare
 4652ms - LibraryData::prepare
 1665ms - LibraryData::prepare
 4398ms - LibraryData::prepare
 1685ms - LibraryData::prepare
 2008ms - LibraryData::prepare
57160ms - handle_code_action
    57160ms - diagnostics
        27521ms - SourceBinder::to_module_def
            27521ms - crate_def_map
                27521ms - compute_crate_def_map
                     1978ms - crate_def_map
                         1973ms - compute_crate_def_map
                                5ms - enum_data_query (7 calls)
                             1937ms - raw_items_query (3900 calls)
                            4ms - parse_query (1 calls)
                     4937ms - crate_def_map
                         4937ms - compute_crate_def_map
                             4879ms - crate_def_map
                                 4879ms - compute_crate_def_map
                                     4844ms - crate_def_map
                                         4844ms - compute_crate_def_map
                                                5ms - crate_def_map (11827 calls)
                                             4364ms - raw_items_query (11810 calls)
                                        0ms - crate_def_map (7 calls)
                                        1ms - raw_items_query (1 calls)
                               51ms - crate_def_map (29 calls)
                                0ms - enum_data_query (1 calls)
                                6ms - raw_items_query (17 calls)
                     1250ms - crate_def_map
                         1250ms - compute_crate_def_map
                             1223ms - crate_def_map
                                 1223ms - compute_crate_def_map
                                     1049ms - crate_def_map
                                         1049ms - compute_crate_def_map
                                             1033ms - crate_def_map (199 calls)
                                                0ms - enum_data_query (1 calls)
                                               15ms - raw_items_query (39 calls)
                                       19ms - crate_def_map (429 calls)
                                        0ms - enum_data_query (3 calls)
                                      150ms - raw_items_query (137 calls)
                                0ms - crate_def_map (81 calls)
                               26ms - raw_items_query (28 calls)
                     3057ms - crate_def_map
                         3057ms - compute_crate_def_map
                             2389ms - crate_def_map
                                 2389ms - compute_crate_def_map
                                     2333ms - crate_def_map
                                         2333ms - compute_crate_def_map
                                             2267ms - crate_def_map
                                                 2267ms - compute_crate_def_map
                                                     1851ms - crate_def_map
                                                         1851ms - compute_crate_def_map
                                                                1ms - crate_def_map (4021 calls)
                                                             1783ms - raw_items_query (4014 calls)
                                                      388ms - crate_def_map (153 calls)
                                                       27ms - raw_items_query (52 calls)
                                               25ms - crate_def_map (226 calls)
                                               39ms - raw_items_query (32 calls)
                                       37ms - crate_def_map (125 calls)
                                       18ms - raw_items_query (27 calls)
                               88ms - crate_def_map (1475 calls)
                                0ms - enum_data_query (1 calls)
                              556ms - raw_items_query (1271 calls)
                     2727ms - crate_def_map
                         2727ms - compute_crate_def_map
                             2644ms - crate_def_map (311 calls)
                                0ms - enum_data_query (1 calls)
                               81ms - raw_items_query (102 calls)
                     1508ms - crate_def_map
                         1508ms - compute_crate_def_map
                             1229ms - crate_def_map (514 calls)
                                0ms - enum_data_query (6 calls)
                              274ms - raw_items_query (233 calls)
                     4739ms - crate_def_map
                         4739ms - compute_crate_def_map
                             1489ms - crate_def_map
                                 1489ms - compute_crate_def_map
                                     1296ms - crate_def_map (701 calls)
                                        0ms - enum_data_query (1 calls)
                                      188ms - raw_items_query (185 calls)
                             3168ms - crate_def_map (338 calls)
                               79ms - raw_items_query (52 calls)
                     1219ms - crate_def_map
                         1219ms - compute_crate_def_map
                             1083ms - crate_def_map (485 calls)
                                0ms - enum_data_query (5 calls)
                              132ms - raw_items_query (172 calls)
                     1239ms - crate_def_map
                         1239ms - compute_crate_def_map
                             1123ms - crate_def_map (1133 calls)
                              111ms - raw_items_query (187 calls)
                     4581ms - crate_def_map (2064 calls)
                      270ms - raw_items_query (918 calls)
        29637ms - Module::diagnostics
            26839ms - Module::diagnostics
                23858ms - Function::diagnostics
                    23858ms - infer
                        23858ms - do_infer
                             1715ms - impls_in_crate_query
                                    3ms - crate_def_map (19472 calls)
                                 1361ms - parse_macro_query (5080 calls)
                                   88ms - parse_query (28 calls)
                             2524ms - impls_in_crate_query
                                   14ms - crate_def_map (80562 calls)
                                 2133ms - parse_macro_query (9637 calls)
                             1078ms - impls_in_crate_query
                                    4ms - crate_def_map (23053 calls)
                                  941ms - parse_macro_query (2471 calls)
                             1475ms - impls_in_crate_query
                                    1ms - crate_def_map (5371 calls)
                                 1335ms - parse_macro_query (2995 calls)
                                   33ms - parse_query (23 calls)
                             1296ms - trait_solve_query
                                    0ms - crate_def_map (1184 calls)
                                 1276ms - impl_datum (601 calls)
                                    3ms - parse_query (1 calls)
                                0ms - body_with_source_map_query (1 calls)
                                0ms - crate_def_map (299 calls)
                            13755ms - impls_in_crate_query (348 calls)
                             1055ms - parse_macro_query (3115 calls)
                              384ms - parse_query (102 calls)
                              441ms - trait_solve_query (16 calls)
                 1265ms - Function::diagnostics
                     1265ms - infer
                         1265ms - do_infer
                             1263ms - trait_solve_query
                                    0ms - crate_def_map (1 calls)
                                 1257ms - impl_datum (446 calls)
                                0ms - body_with_source_map_query (1 calls)
                                0ms - crate_def_map (23 calls)
                                2ms - trait_solve_query (6 calls)
                 1715ms - Function::diagnostics (4 calls)
                    0ms - crate_def_map (3 calls)
             2746ms - Function::diagnostics
                 2746ms - infer
                     2746ms - do_infer
                         1479ms - trait_solve_query
                                0ms - crate_def_map (1402 calls)
                              169ms - impl_datum (5891 calls)
                               20ms - parse_macro_query (13 calls)
                             1144ms - parse_query (191 calls)
                            4ms - body_with_source_map_query (1 calls)
                            0ms - crate_def_map (392 calls)
                            1ms - parse_macro_query (4 calls)
                           21ms - parse_query (6 calls)
                         1233ms - trait_solve_query (40 calls)
                8ms - Function::diagnostics (1 calls)
               42ms - Module::diagnostics (1 calls)
                0ms - crate_def_map (3 calls)
        0ms - SourceBinder::analyzer (1 calls)
        0ms - add_missing_impl_members_inner (2 calls)
Laurențiu Nicola (Feb 17 2020 at 19:32, on Zulip):

I got another one, with inlay_hints taking 55s: https://gist.github.com/lnicola/1ff7a8e195a82b848517f2d483c77e1f. I guess that's fine? But why are they called so many times?

matklad (Feb 17 2020 at 19:38, on Zulip):

That's the first call, right?

Laurențiu Nicola (Feb 17 2020 at 19:39, on Zulip):

Yup

Laurențiu Nicola (Feb 17 2020 at 19:40, on Zulip):

For context: https://github.com/rust-analyzer/rust-analyzer/issues/3057#issuecomment-587122420. The gist is from the 75 s run.

matklad (Feb 17 2020 at 19:40, on Zulip):

I guess in general this is expected, but 4364ms - raw_items_query (11810 calls) does seem odd -- that's 11k files/module-level macros

Laurențiu Nicola (Feb 17 2020 at 19:42, on Zulip):

The project uses Rocket, so there might be a lot of them, but 11k seems large.

Laurențiu Nicola (Feb 17 2020 at 19:42, on Zulip):

And why the 30? rust-analyzer/inlayHints requests on a single file?

Laurențiu Nicola (Feb 17 2020 at 19:46, on Zulip):

Stupid question: should https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/inlay_hints.rs#L35 be using descendants here?

matklad (Feb 17 2020 at 19:48, on Zulip):

Yep, it should, because we want to visit every node

Laurențiu Nicola (Feb 17 2020 at 19:48, on Zulip):

Won't it visit nodes multiple times?

matklad (Feb 17 2020 at 19:48, on Zulip):

it probably makes sense to put the profile call to a more reasonable place though -- it doesn't really make sense to count how many times are we calculating hints for every semicolon

matklad (Feb 17 2020 at 19:49, on Zulip):

Won't it visit nodes multiple times?

nope, get_inlay_hints is non-recursive

Laurențiu Nicola (Feb 17 2020 at 19:51, on Zulip):

get_inlay_hints seems to handle statements, but inlay_hints will visit functions, every statement in a function, and so on

Kirill Bulatov (Feb 17 2020 at 19:52, on Zulip):

Just for a context, after we deal with https://github.com/rust-analyzer/rust-analyzer/issues/1618 , we should be able to throw off the majority of the code there, analyzing the PAT's and a bunch of parent nodes for a few cases only.

Laurențiu Nicola (Feb 17 2020 at 19:58, on Zulip):

Ah, I see what you meant. Sorry.

Laurențiu Nicola (Feb 22 2020 at 16:45, on Zulip):

Kirill Bulatov said:

Just for a context, after we deal with https://github.com/rust-analyzer/rust-analyzer/issues/1618 , we should be able to throw off the majority of the code there, analyzing the PAT's and a bunch of parent nodes for a few cases only.

So the code can be simplified now?

Kirill Bulatov (Feb 22 2020 at 17:44, on Zulip):

Yes, hopefully.

I plan to refactor the code as part of https://github.com/rust-analyzer/rust-analyzer/issues/3273 , if nobody comes with the PR for that before.

Last update: Sep 30 2020 at 16:30UTC