-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Reduce macro usage for lints #104863
Reduce macro usage for lints #104863
Conversation
Commit 2 removes the |
The option was added in #57726 to enable better benchmarking of lints. |
Sure... the question is whether it's useful. Is anyone benchmarking lints with this option? |
ec369f3
to
7d67d7a
Compare
r=me for the first commit; if you want to keep the others I think you should make an MCP for removing the flag. Btw, IMO it would be nice to remove the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really concerned about -Zno-interleave-lints
.
It has quite a significant complexity cost for a profiling option, and I'm not sure anybody used it besides who introduced it.
tracing
is proably enough for timings, and profiling tools do not need this.
7d67d7a
to
aee176d
Compare
I have added five new commits that put I feel like this doesn't need an MCP. There was no MCP for #102725 which was similar to this -- removing an obscure unstable flag that is only used for compiling rustc itself. |
This comment has been minimized.
This comment has been minimized.
Odd, I don't get these errors when I compile locally:
|
Looks like the failure was in a |
This comment has been minimized.
This comment has been minimized.
e711bf7
to
2e880e5
Compare
Some tests that only run with |
The second argument to |
Well, I got those |
The lint definitions use macros heavily. This commit merges some of them that are split unnecessarily. I find the reduced indirection makes it easier to imagine what the generated code will look like.
Because it complicates lint implementation greatly.
These were enabled by the removal of `-Zno-interleave-lints`.
This avoids calling the `late_lint_{mod_pass,pass_crate}` twice.
It has a single call site.
It has a single call site.
Required to get the parallel compiler building again.
I tried the early lint change again. Most of the But there is one remaining bizarre failure:
|
Oh, I was accidentally using a parallel compiler build, sigh. |
This avoids calling `early_lint_node` twice. Note: one `early_lint_node` call had `!pre_expansion` for the second argument and the other had `false`. The new single call just has `!pre_expansion`. This results in a reduction of duplicate error messages in some `ui-fulldeps` tests. The order of some `ui-fulldeps` output also changes, but that doesn't matter.
@bors r+ rollup=iffy |
☀️ Test successful - checks-actions |
Finished benchmarking commit (e960b5e): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
Ugh, that's unexpected. Lots of instruction count regressions, but cycles and wall times didn't change. I'll take a look on Monday. |
These were the two commits that caused the regressions:
The cachegrind diffs indicate that it's not because any extra work was being done. It just appears to be due to minor changes in code generation, mostly around |
#105291 improved things slightly, though less than I had hoped based on local measurements. I have another idea, an idea which I had before I wrote this PR, and and idea for which this PR is a prerequisite. Currently when processing a node such as an expression, we call |
I was wrong about this. Well, it's relevant for clippy, but for rustc all the builtin lints get merged into a small number of "combined" lints via a macro-based mechanism, which lets the empty I also tried tweaking some inlining in #105416. It helped locally, but didn't make much difference for a CI perf run. |
#105485 should fix the perf regression properly, by reverting part of this PR's changes. |
@rustbot label: +perf-regression-triaged |
This commit partly undoes rust-lang#104863, which combined the builtin lints pass with other lints. This caused a slowdown, because often there are no other lints, and it's faster to do a pass with a single lint directly than it is to do a combined pass with a `passes` vector containing a single lint.
…s, r=cjgillot Fix lint perf regressions rust-lang#104863 caused small but widespread regressions in lint performance. I tried to improve things in rust-lang#105291 and rust-lang#105416 with minimal success, before fully understanding what caused the regression. This PR effectively reverts all of rust-lang#105291 and part of rust-lang#104863 to fix the perf regression. r? `@cjgillot`
Clean up some comments on lint implementation This updates some doc comments that have gotten very out of date. Some of these macros were removed or renamed in rust-lang#57726 and rust-lang#104863 and others. Manual emitting of lints was significantly reworked when the `Diagnostic` infrastructure was added. Rather than try to replicate the high-level documentation, I added pointers to the rustc-dev-guide. I linkified some types so that if they are renamed/removed without updating the docs, it will break CI.
Clean up some comments on lint implementation This updates some doc comments that have gotten very out of date. Some of these macros were removed or renamed in rust-lang#57726 and rust-lang#104863 and others. Manual emitting of lints was significantly reworked when the `Diagnostic` infrastructure was added. Rather than try to replicate the high-level documentation, I added pointers to the rustc-dev-guide. I linkified some types so that if they are renamed/removed without updating the docs, it will break CI.
Rollup merge of rust-lang#132221 - ehuss:lint-docs, r=compiler-errors Clean up some comments on lint implementation This updates some doc comments that have gotten very out of date. Some of these macros were removed or renamed in rust-lang#57726 and rust-lang#104863 and others. Manual emitting of lints was significantly reworked when the `Diagnostic` infrastructure was added. Rather than try to replicate the high-level documentation, I added pointers to the rustc-dev-guide. I linkified some types so that if they are renamed/removed without updating the docs, it will break CI.
r? @cjgillot