-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Split match exhaustiveness into two files #79284
Conversation
My guess is it was called |
@mark-i-m but there's already |
☔ The latest upstream changes (presumably #79441) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
Sorry, I know this is predisposed to merge conflicts because of its size. I will try to review soon; I just need to set aside some time to look through the changes. |
@varkor No worries. I'm just moving code around so it should be quick to review. Do you have an opinion on whether I could rename |
I'd be happy changing the name to |
I also wondered about the name (other than the point @mark-i-m raised about it denoting the I'm happy with the changes, once the merge conflicts have been addressed. |
d46dcf5
to
941c6ac
Compare
Fixed the conflict, and renamed |
Upping the priority because this is liable to conflict. @bors r+ p=1 |
📌 Commit 941c6ac has been approved by |
☀️ Test successful - checks-actions |
Thanks! |
@Nadrieril @varkor This change caused a very large performance regression in the |
Those are very significant. There weren't very many actual changes, so hopefully it should be possible to narrow down the issue. @Nadrieril: are you able to investigate this? |
Note that a very plausible answer here is "CGU changed, inlining changed" -- modules are the basis for our CGU partitioning scheme, so splitting them can have outsized effects even if you're just moving code around. Where there any actual changes made or did we just move code around? |
It was just code being moved around, so I imagine it was something like this. |
Would be good to see if we can add a |
Ouch, I did not think that moving code could have such an impact. Will investigate |
I'm super confused: I just measured the same commit range locally and I see no difference at all. Must be something in my changelog-seen = 2
[llvm]
download-ci-llvm = true
assertions = true
[rust]
debug-logging = true
debuginfo-level-rustc = 1
incremental = true
deny-warnings = false Could |
There's a few differences: incremental bumps CGU counts to one-per-module IIRC, and I think might disable some of the merging that happens normally? We also lower the ThinLTO import limit to 10 (from 100?) IIRC for LLVM when compiling incrementally, which you can manually set in config.toml (thin-to-instr-limit I believe). |
I tried again and yup without incremental I can reproduce. Are you saying that incremental+thin-to-instr-limit=100 might reproduce too? Or do you think it's more probably the CGU counts stuff? I'd love a reproduction with incremental because it makes it way quicker to try things |
Hm, not sure, and I don't recall what the limit actually is by default w/o incremental unfortunately (100 is just a guess). |
|
Unsurprisingly the commit the broke perf is the one where I move half the code to a new file. Found a fix: #79680 |
…as-schievink Fix perf regression caused by rust-lang#79284 rust-lang#79284 only moved code around but this changed inlining and caused a large perf regression. This fixes it for me, though I'm less confident than usual because the regression was not observable with my usual (i.e. incremental) compilation settings. r? `@Mark-Simulacrum`
…g, r=varkor Clarify constructor splitting in exhaustiveness checking I reworked the explanation of the algorithm completely to make it properly account for the various extensions we've added. This includes constructor splitting, which was previously not clearly included in the algorithm. This makes wildcards less magical; I added some detailed examples; and this distinguishes clearly between constructors that only make sense in patterns (like ranges) and those that make sense for values (like `Some`). This reformulation had been floating around in my mind for a while, and I'm quite happy with how it turned out. Let me know how you feel about it. I also factored out all three cases of splitting (wildcards, ranges and slices) into dedicated structs to encapsulate the complicated bits. I measured no perf impact but I don't trust my local measurements for refactors since rust-lang#79284. r? `@varkor` `@rustbot` modify labels: +A-exhaustiveness-checking
I feel the constructor-related things in the
_match
module make enough sense on their own so I split them off. It makes_match
feel less like a complicated mess. I'm not aware of PRs in progress against this module apart from my own so hopefully I'm not annoying too many people.I have a lot of questions about the conventions in naming and modules around the compiler. Like, why is the module named
_match
? Could I rename it tousefulness
maybe? Shoulddeconstruct_pat
be a submodule of_match
since only_match
uses it? Is it ok to move big piles of code around even if it makes git blame more difficult?r? @varkor
@rustbot modify labels: +A-exhaustiveness-checking