Stream: t-compiler/wg-rls-2.0

Topic: Chalk solver caching


Florian Diebold (Mar 06 2020 at 19:21, on Zulip):

@matklad I'm trying out what happens if we just don't cache the solver and recreate it for every trait query. It feels much faster during editing, and seems to be only slightly slower (if at all) in analysis-stats

matklad (Mar 06 2020 at 19:33, on Zulip):

hm, lol?

matklad (Mar 06 2020 at 19:35, on Zulip):

So, the difference is that:

matklad (Mar 06 2020 at 19:36, on Zulip):

I wonder if the sweet spot is creating a solver per inference context?

Florian Diebold (Mar 06 2020 at 19:39, on Zulip):

not sure what you mean by

we don't store salsa's metadata?

Florian Diebold (Mar 06 2020 at 19:40, on Zulip):

it does mean we actually have clean dependency information for each trait query, and don't have to redo all of them every time something changes

Florian Diebold (Mar 06 2020 at 19:40, on Zulip):

also another benefit would be that we can actually run trait queries in parallel, I guess

matklad (Mar 06 2020 at 19:40, on Zulip):

ahhhh

matklad (Mar 06 2020 at 19:41, on Zulip):

right, so the trait_solver query is no longer volatile, and trait_solve q can actually be usefully cache!

Florian Diebold (Mar 06 2020 at 19:41, on Zulip):

and presumably the Chalk-internal caching isn't that huge of a win (assuming most solution are actually pretty shallow)

matklad (Mar 06 2020 at 19:42, on Zulip):

and this also should fix the problem of analysis-statis OOMing on substrate repo due to chalk being big

matklad (Mar 06 2020 at 19:45, on Zulip):

@Florian Diebold could you repeat https://github.com/rust-analyzer/rust-analyzer/issues/2945 with your patch?

Florian Diebold (Mar 06 2020 at 19:45, on Zulip):

sure

Florian Diebold (Mar 06 2020 at 22:02, on Zulip):

@matklad it gets killed after ca. 75%, with ca. 28G resident memory :(

matklad (Mar 06 2020 at 22:38, on Zulip):

Hm, I am running it on substrate, and I have a feeling that it doesn't get to chalk at all

matklad (Mar 06 2020 at 22:38, on Zulip):

Ie, I am seeing two "name resolution is stuck" errors (and we've recently bumped the limit there a lot)

matklad (Mar 06 2020 at 22:39, on Zulip):

which reminds me that I want to rewrite our name resolution loop (which is basically my permanent state?)

matklad (Mar 06 2020 at 22:49, on Zulip):

Wow, it feels a bunch faster indeed

matklad (Mar 06 2020 at 22:50, on Zulip):

also another benefit would be that we can actually run trait queries in parallel, I guess

A good start might be to add -j flag to analysis-stats. One needs this trick for it to work with salsa

Florian Diebold (Mar 06 2020 at 23:19, on Zulip):

matklad said:

Ie, I am seeing two "name resolution is stuck" errors (and we've recently bumped the limit there a lot)

it does get past that after some time

Edwin Cheng (Mar 07 2020 at 04:09, on Zulip):

Ie, I am seeing two "name resolution is stuck" errors (and we've recently bumped the limit there a lot)

It seem to relate to include macro , I am investigating now.

Edwin Cheng (Mar 07 2020 at 04:10, on Zulip):

I saw the same error in my ra-stats tool after my PR.

Edwin Cheng (Mar 07 2020 at 04:48, on Zulip):

Oh... haha, it is because the include macro expanded correctly, however we have a dummy env macro implementation such that a include!(concat!(env!("OUT_DIR"), "/foo.rs")) will became include!("/foo.rs"), and here may be a infinite loop. :)

Edwin Cheng (Mar 07 2020 at 05:06, on Zulip):

(rust-analyzer/rust-analyzer#3508) should fix it.

Christopher Durham (Mar 08 2020 at 19:51, on Zulip):

Ha, looks like IntelliJ Rust fixed this same exact issue somewhat recently https://github.com/intellij-rust/intellij-rust/pull/4584

Last update: May 29 2020 at 17:05UTC