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

Add an early-exit to overlapping_impls #69010

Closed
wants to merge 1 commit into from
Closed

Add an early-exit to overlapping_impls #69010

wants to merge 1 commit into from

Conversation

jonas-schievink
Copy link
Contributor

This is hit in approx. 37% of all calls when building the stm32f0(x2) crate, saving a small amount of time.

This can probably be done more effectively than using simplify_type, since that only seems to descend by one layer.

This triggers in approx. 37% of all calls when building the stm32f0(x2)
crate, saving a small amount of time.
@rust-highfive
Copy link
Collaborator

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 10, 2020
@jonas-schievink
Copy link
Contributor Author

@bors try @rust-timer queue

@bors
Copy link
Contributor

bors commented Feb 10, 2020

⌛ Trying commit d0bbdc3 with merge 96ce90522e7dba6b32713401457c46f5d2156065...

@bors
Copy link
Contributor

bors commented Feb 10, 2020

☀️ Try build successful - checks-azure
Build commit: 96ce90522e7dba6b32713401457c46f5d2156065 (96ce90522e7dba6b32713401457c46f5d2156065)

@jonas-schievink

This comment has been minimized.

@rust-timer

This comment has been minimized.

@jonas-schievink
Copy link
Contributor Author

@rust-timer build 96ce905

@rust-timer
Copy link
Collaborator

Queued 96ce90522e7dba6b32713401457c46f5d2156065 with parent 71c7e14, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 96ce90522e7dba6b32713401457c46f5d2156065, comparison URL.

@jonas-schievink
Copy link
Contributor Author

Hmm, this made things slightly worse for a few benchmarks, and shows no improvements

@jonas-schievink
Copy link
Contributor Author

jonas-schievink commented Feb 10, 2020

I checked against nrf52810-pac, and there it reduces the time spent in coherence by ~45-50% (from ~5 seconds to 2.6), so it definitely helps in some cases.

@matprec
Copy link
Contributor

matprec commented Feb 11, 2020

Would adding crates impacted by this to the rustc perf suite make sense? That the improvement you see locally do not appear in the suite suggests the these code paths are not properly exercised.

@jonas-schievink
Copy link
Contributor Author

Indeed, and I am planning to do that, however we plan to make a number of changes to the code generator for these crates, which could change the parts of rustc they stress. I also plan to change it so the generated code builds faster all around (in addition to improving rustc performance in general).

@estebank
Copy link
Contributor

I am slightly worried about the mild regressions, but syn actually improved.

@rust-lang/compiler Let's keep an eye out for this in case there are more regressions in the wild, but I believe that this should have a net positive impact.

@bors r+ rollup=never

@bors
Copy link
Contributor

bors commented Feb 18, 2020

📌 Commit d0bbdc3 has been approved by estebank

@bors
Copy link
Contributor

bors commented Feb 18, 2020

🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 18, 2020
@estebank
Copy link
Contributor

@bors r- as it needs a rebase.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 18, 2020
@jonas-schievink
Copy link
Contributor Author

syn-opt is extremely noisy, it probably didn't actually improve. I'll have to re-check the results anyways since other optimizations have landed since.

@petrochenkov
Copy link
Contributor

ping in #69010 (comment)

[triagebot] I've seen eddyb mentioning that syn is noisy a couple of times.

@eddyb
Copy link
Member

eddyb commented Feb 27, 2020

I've seen eddyb mentioning that syn is noisy a couple of times.

Yeah, the issue is #69060, and we keep seeing this pretty often.

@joelpalmer
Copy link

Triaged

@Dylan-DPC-zz
Copy link

@jonas-schievink waiting on a rebase

@jonas-schievink
Copy link
Contributor Author

The benchmark still looks like a slight regression. I'll have to measure this again, but I've landed some other improvements in this area, so this might not even be necessary anymore. For now, closing this until I have more time to work on compile-time improvements again.

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2021
Try fast_reject::simplify_type in coherence before doing full check

This is a reattempt at landing rust-lang#69010 (by `@jonas-schievink).` The change adds a fast path for coherence checking to see if there's no way for types to unify since full coherence checking can be somewhat expensive.

This has big effects on code generated by the [`windows`](https://github.com/microsoft/windows-rs) which in some cases spends as much as 20% of compilation time in the `specialization_graph_of` query. In local benchmarks this took a compilation that previously took ~500 seconds down to ~380 seconds.

This is surely not going to make a difference on much smaller crates, so the question is whether it will have a negative impact. rust-lang#69010 was closed because some of the perf suite crates did show small regressions.

Additional discussion of this issue is happening [here](https://rust-lang.zulipchat.com/#narrow/stream/247081-t-compiler.2Fperformance/topic/windows-rs.20perf).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants