-
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
Avoid chain()
in find_constraint_paths_between_regions()
.
#64801
Avoid chain()
in find_constraint_paths_between_regions()
.
#64801
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion |
…een_regions, r=<try> Avoid `chain()` in `find_constraint_paths_between_regions()`. This iterator can be hot, and chained iterators are slow. The second half of the chain is almost always empty, so this commit specializes the code to avoid the chained iteration. This change reduces instruction counts for the `wg-grammar` benchmark by up to 1.5%.
I'd get rid of the is_empty check, and move the code currently in Also, you're currently calling |
☀️ Try build successful - checks-azure |
Queued c30cab8 with parent a5bc0f0, future comparison URL. |
Drive by comment, but wouldn't just swapping for constraint in outgoing_edges_from_graph.chain(outgoing_edges_from_picks) for outgoing_edges_from_graph.chain(outgoing_edges_from_picks).for_each(|constraint| achieve the same effect? |
@matklad: How would that help? |
I'll tag @scottmcm who actually knows this stuff, but my understanding is that
I think, in the actual coude, this bottoms out in this fold override. Because of this, |
src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
Finished benchmarking try commit c30cab8, comparison URL. |
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.
Other than my and @jakubadamw's nitpick, you can consider it an r+ from me.
src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
Outdated
Show resolved
Hide resolved
This iterator can be hot, and chained iterators are slow. The second half of the chain is almost always empty, so this commit changes the code to avoid the chained iteration. This change reduces instruction counts for the `wg-grammar` benchmark by up to 1.5%.
60fa535
to
5ca99b7
Compare
Thanks for the various comments, I have addressed them all. @estebank, the new code is sufficiently different that you might want to take another look. |
@matklad: I tried using |
📌 Commit 5ca99b7 has been approved by |
…_paths_between_regions, r=estebank Avoid `chain()` in `find_constraint_paths_between_regions()`. This iterator can be hot, and chained iterators are slow. The second half of the chain is almost always empty, so this commit specializes the code to avoid the chained iteration. This change reduces instruction counts for the `wg-grammar` benchmark by up to 1.5%.
Rollup of 11 pull requests Successful merges: - #64649 (Avoid ICE on return outside of fn with literal array) - #64722 (Make all alt builders produce parallel-enabled compilers) - #64801 (Avoid `chain()` in `find_constraint_paths_between_regions()`.) - #64805 (Still more `ObligationForest` improvements.) - #64840 (SelfProfiler API refactoring and part one of event review) - #64885 (use try_fold instead of try_for_each to reduce compile time) - #64942 (Fix clippy warnings) - #64952 (Update cargo.) - #64974 (Fix zebra-striping in generic dataflow visualization) - #64978 (Fully clear `HandlerInner` in `Handler::reset_err_count`) - #64979 (Update books) Failed merges: - #64959 (syntax: improve parameter without type suggestions) r? @ghost
This iterator can be hot, and chained iterators are slow. The second
half of the chain is almost always empty, so this commit specializes the
code to avoid the chained iteration.
This change reduces instruction counts for the
wg-grammar
benchmark byup to 1.5%.