-
Notifications
You must be signed in to change notification settings - Fork 13.4k
perf: Avoid creating a SmallVec if nothing changes during a fold #68031
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
Conversation
Not sure if this helps but in theory it should be less work than what the current micro optimization does for `ty::Predicate` lists. (It would explain the overhead I am seeing from `perf`.)
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion |
perf: Avoid creating a SmallVec if nothing changes during a fold Not sure if this helps but in theory it should be less work than what the current micro optimization does for `ty::Predicate` lists. (It would explain the overhead I am seeing from `perf`.)
@@ -1073,3 +1060,29 @@ impl<'tcx> TypeFoldable<'tcx> for InferConst<'tcx> { | |||
false | |||
} | |||
} | |||
|
|||
fn fold_list<'tcx, F, T>( |
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.
Might be worth adding a comment here that explain that this is an optimization over .iter().map(...).collect()
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.
Done in a1586f1
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
💔 Test failed - checks-azure |
This could use a perf run now. |
@bors try @rust-timer queue |
Awaiting bors try build completion |
perf: Avoid creating a SmallVec if nothing changes during a fold Not sure if this helps but in theory it should be less work than what the current micro optimization does for `ty::Predicate` lists. (It would explain the overhead I am seeing from `perf`.)
☀️ Try build successful - checks-azure |
Queued 64c086d with parent 4884061, future comparison URL. |
Finished benchmarking try commit 64c086d, comparison URL. |
Perf results look good. Should be good to merge? |
@bors r+ |
📌 Commit a1586f1 has been approved by |
perf: Avoid creating a SmallVec if nothing changes during a fold Not sure if this helps but in theory it should be less work than what the current micro optimization does for `ty::Predicate` lists. (It would explain the overhead I am seeing from `perf`.)
☀️ Test successful - checks-azure |
Not sure if this helps but in theory it should be less work than what
the current micro optimization does for
ty::Predicate
lists.(It would explain the overhead I am seeing from
perf
.)