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

Recent 12% perf regression in unused-warnings #52092

Closed
alexcrichton opened this issue Jul 6, 2018 · 12 comments
Closed

Recent 12% perf regression in unused-warnings #52092

alexcrichton opened this issue Jul 6, 2018 · 12 comments
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. I-compiletime Issue: Problems and improvements with respect to compile times. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

A recent perf regression showed up somewhere in this range. I don't think perf has enough data to narrow it down further yet to a particular PR, but of the PRs in that list #51895 looks the most suspect.

@nikomatsakis or @tmandry y'all may be interested in this!

@alexcrichton alexcrichton added I-compiletime Issue: Problems and improvements with respect to compile times. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 6, 2018
@alexcrichton alexcrichton changed the title Recent 8% perf regression in unused-warnings Recent 12% perf regression in unused-warnings Jul 6, 2018
@alexcrichton
Copy link
Member Author

The wall time measurements look a bit more severe :(

also cc @nnethercote

@nnethercote
Copy link
Contributor

perf.rust-lang.org now clearly points to PR #51895:
a739c51...8dd715e

@pnkfelix
Copy link
Member

visiting for triage. Assigning to @nikomatsakis for now, under assumption that he is best person to investigate this in the very short term.

@pnkfelix
Copy link
Member

also making P-high for now. (I'm not 100% clear on how important the efficiency of this particular benchmark is, but it is probably worth treating it as high until someone can provide an argument for deprioritization.)

@pnkfelix pnkfelix added the P-high High priority label Jul 12, 2018
@nikomatsakis
Copy link
Contributor

I can investigate, but I'm not all that worried about this particular benchmark. It'd be good to do a quick profile though. I can't really imagine how this would make things slower apart from the fact that I did add a bit of data to metadata -- so maybe it's just the extra encoding costs?

@nikomatsakis
Copy link
Contributor

I've not done any investigation this week. I lost access to my linux machine I use for profiling, so it will have to wait until 2 weeks from now when I'm back home. (Unless someone else wants to take a look.)

@pnkfelix pnkfelix self-assigned this Jul 26, 2018
@pnkfelix
Copy link
Member

visiting for triage, assigning to self in hopes I find time to look at this during next week.

@pietroalbini pietroalbini added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jul 31, 2018
@pnkfelix
Copy link
Member

pnkfelix commented Aug 2, 2018

unassigning self since I will be absent for three weeks after end of day tomorrow.

@pnkfelix pnkfelix removed their assignment Aug 2, 2018
@arielb1
Copy link
Contributor

arielb1 commented Aug 26, 2018

The relevant test file mainly consists of 20,000 use statements without any content.

I had looked at this, and it is at least 90% accountable to the addition of 2*20,000 query calls during the processing:

  1. The new predicates_defined_on query: https://github.com/rust-lang/rust/pull/51895/files#diff-4ed25c00aceb84666fca639cf8101c7cR1313
  2. explicit_predicates_of at https://github.com/rust-lang/rust/pull/51895/files#diff-4ed25c00aceb84666fca639cf8101c7cR1316 being changed from a function call to a query

This does feel like an edge-case to me - in most cases I can think of, the query overhead of actually collecting an item - which is just a few microseconds per item (about 1-2μs/query cache miss, so, including all the actions param_env makes, ~10μs/use-ish on my fairly slow laptop) - is far below the overhead of actually processing that item.

However, if we want to just "get rid of the regression", it might be a good idea to add a bypass to param_env on item classes that can't have generics (at least, use items) that avoids the entire query mechanism. This might speed up artificial code that has a lot of generic-free items.

And of course it's always a good idea to speed up queries.

@arielb1
Copy link
Contributor

arielb1 commented Aug 26, 2018

I would lower this issue to P-medium unless someone actually cares about this case, this code is going to get refactored to death anyway.

@nikomatsakis nikomatsakis removed their assignment Aug 30, 2018
@pnkfelix
Copy link
Member

downgrading to P-medium on basis on analysis and arguments presented by @arielb1 above.

@pnkfelix pnkfelix added P-medium Medium priority and removed P-high High priority labels Aug 30, 2018
@pietroalbini pietroalbini added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Sep 20, 2018
@pietroalbini pietroalbini removed the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Sep 20, 2018
@jonas-schievink jonas-schievink added the A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. label Feb 8, 2020
@Mark-Simulacrum
Copy link
Member

Given it's been 5(!) years I don't think there's value in keeping this open -- at best, this is tracking "can we make unused-warnings faster?" which feels like not a useful thing to track.

@Mark-Simulacrum Mark-Simulacrum closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. I-compiletime Issue: Problems and improvements with respect to compile times. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants