Skip to content

Expand FlattenCompat folds #82162

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

Merged
merged 1 commit into from
Feb 25, 2021
Merged

Expand FlattenCompat folds #82162

merged 1 commit into from
Feb 25, 2021

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Feb 15, 2021

The former chain+chain+fold implementation looked nice from a
functional-programming perspective, but it introduced unnecessary layers
of abstraction on every flat_map/flatten fold. It's straightforward
to just fold each part in turn, and this makes it look like a simplified
version of the existing try_fold implementation.

For the iter::bench_flat_map* benchmarks, I get a large improvement in
bench_flat_map_chain_sum, from 1,598,473 ns/iter to 499,889 ns/iter,
and the rest are unchanged.

The former `chain`+`chain`+`fold` implementation looked nice from a
functional-programming perspective, but it introduced unnecessary layers
of abstraction on every `flat_map`/`flatten` fold. It's straightforward
to just fold each part in turn, and this makes it look like a simplified
version of the existing `try_fold` implementation.

For the `iter::bench_flat_map*` benchmarks, I get a large improvement in
`bench_flat_map_chain_sum`, from 1,598,473 ns/iter to 499,889 ns/iter,
and the rest are unchanged.
@rust-highfive
Copy link
Contributor

r? @Mark-Simulacrum

(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 15, 2021
@Mark-Simulacrum
Copy link
Member

@bors try @rust-timer queue

r=me if perf looks reasonable (improved or unchanged)

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 20, 2021
@bors
Copy link
Collaborator

bors commented Feb 20, 2021

⌛ Trying commit fc150d1 with merge 031d8ee87cc71178b63641c7fce0155a5da0aacb...

@Mark-Simulacrum Mark-Simulacrum removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 20, 2021
@bors
Copy link
Collaborator

bors commented Feb 20, 2021

☀️ Try build successful - checks-actions
Build commit: 031d8ee87cc71178b63641c7fce0155a5da0aacb (031d8ee87cc71178b63641c7fce0155a5da0aacb)

@rust-timer
Copy link
Collaborator

Queued 031d8ee87cc71178b63641c7fce0155a5da0aacb with parent 83b30a6, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (031d8ee87cc71178b63641c7fce0155a5da0aacb): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 21, 2021
@cuviper
Copy link
Member Author

cuviper commented Feb 21, 2021

r=me if perf looks reasonable (improved or unchanged)

I think it does look like this went in the right direction, so...

@bors r=Mark-Simulacrum

@bors
Copy link
Collaborator

bors commented Feb 21, 2021

📌 Commit fc150d1 has been approved by Mark-Simulacrum

@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 21, 2021
@bors
Copy link
Collaborator

bors commented Feb 25, 2021

⌛ Testing commit fc150d1 with merge 63bacf1...

@bors
Copy link
Collaborator

bors commented Feb 25, 2021

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 63bacf1 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 25, 2021
@bors bors merged commit 63bacf1 into rust-lang:master Feb 25, 2021
@rustbot rustbot added this to the 1.52.0 milestone Feb 25, 2021
@cuviper cuviper deleted the flat-fold branch September 21, 2021 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants