Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ast-ty-to-ty cache #41733

Merged

Conversation

nikomatsakis
Copy link
Contributor

As discussed on IRC, this basically just removes the cache, and rewrites rustdoc and save-analysis so call into the astconv code. It might make sense for this to be a more fine-grained query, but that would (at least) require us to be using HirId and not NodeId.

(Perhaps I should open a FIXME?)

I didn't measure perf impact (yet?). I did observe that the cache seems to hit rarely -- and only in between items (I experimented with a cache "per def-id", but that had zero hits). In other words, every single hit on the cache is a dependency bug, since it is "shuttling" information between items without dependency edges.

r? @eddyb

@Mark-Simulacrum
Copy link
Member

FYI: The perf impact will be measured for this specific PR as long as it isn't rolled up, so I wouldn't be too concerned with measuring separately.

@@ -115,15 +117,18 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
where F: FnOnce(&mut DumpVisitor<'l, 'tcx, 'll, D>)
{
let item_def_id = self.tcx.hir.local_def_id(item_id);
let old_item_cx = mem::replace(&mut self.save_ctxt.item_cx,
ItemCtxt::new(self.tcx, item_def_id));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah I didn't expect this. I'm not sure we should have this at all. That is, ItemCtxt is just a (TyCtxt, DefId) pair at this point IIRC, and the item_def_id seems to be the important thing to keep?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was debating about stripping it out too -- I was thinking I could just make a pub fn in librustc_typeck that takes a def-id and constructs a "fresh itemctxt". I think when I wrote this patch I was anticipating having a cache per ItemCtxt (but then I checked and found that said cache had zero hits).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking I could just make a pub fn in librustc_typeck that takes a def-id and constructs a "fresh itemctxt"

That's... what ItemCtxt::new is, isn't it?

@@ -53,51 +55,71 @@ use html::item_type::ItemType;
pub mod inline;
mod simplify;

pub struct CleanContext<'a, 'tcx: 'a> {
doc_cx: &'a DocContext<'a, 'tcx>,
item_cx: ItemCtxt<'a, 'tcx>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is... unnecessary? Same thing as before, we really don't need to inflate the diff like this.

@nikomatsakis nikomatsakis force-pushed the incr-comp-remove-ast-ty-to-ty-cache branch from c2ee24d to 3f2dd4d Compare May 4, 2017 01:33
@nikomatsakis
Copy link
Contributor Author

@eddyb ok, take another look.

@eddyb
Copy link
Member

eddyb commented May 4, 2017

@bors r+

@bors
Copy link
Contributor

bors commented May 4, 2017

📌 Commit 3f2dd4d has been approved by eddyb

@bors
Copy link
Contributor

bors commented May 4, 2017

⌛ Testing commit 3f2dd4d with merge b811ad0...

bors added a commit that referenced this pull request May 4, 2017
…he, r=eddyb

Remove ast-ty-to-ty cache

As discussed on IRC, this basically just removes the cache, and rewrites rustdoc and save-analysis so call into the astconv code. It *might* make sense for this to be a more fine-grained query, but that would (at least) require us to be using `HirId` and not `NodeId`.

(Perhaps I should open a FIXME?)

I didn't measure perf impact (yet?). I did observe that the cache seems to hit *rarely* -- and only in between items (I experimented with a cache "per def-id", but that had zero hits). In other words, every single hit on the cache is a dependency bug, since it is "shuttling" information between items without dependency edges.

r? @eddyb
@bors
Copy link
Contributor

bors commented May 4, 2017

💔 Test failed - status-travis

@TimNN
Copy link
Contributor

TimNN commented May 4, 2017

@bors
Copy link
Contributor

bors commented May 4, 2017

⌛ Testing commit 3f2dd4d with merge ac46091...

bors added a commit that referenced this pull request May 4, 2017
…he, r=eddyb

Remove ast-ty-to-ty cache

As discussed on IRC, this basically just removes the cache, and rewrites rustdoc and save-analysis so call into the astconv code. It *might* make sense for this to be a more fine-grained query, but that would (at least) require us to be using `HirId` and not `NodeId`.

(Perhaps I should open a FIXME?)

I didn't measure perf impact (yet?). I did observe that the cache seems to hit *rarely* -- and only in between items (I experimented with a cache "per def-id", but that had zero hits). In other words, every single hit on the cache is a dependency bug, since it is "shuttling" information between items without dependency edges.

r? @eddyb
@bors
Copy link
Contributor

bors commented May 4, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing ac46091 to master...

@bors bors merged commit 3f2dd4d into rust-lang:master May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants