Skip to content

BTreeSet: avoid intermediate sorting when collecting sorted iterators#97868

Merged
bors merged 1 commit into
rust-lang:masterfrom
ssomers:btree_from_sorted_iter
Jun 9, 2022
Merged

BTreeSet: avoid intermediate sorting when collecting sorted iterators#97868
bors merged 1 commit into
rust-lang:masterfrom
ssomers:btree_from_sorted_iter

Conversation

@ssomers

@ssomers ssomers commented Jun 8, 2022

Copy link
Copy Markdown
Contributor

As pointed out by droundy, an obvious optimization is to skip the first step introduced by #88448 (creation of a vector and sorting) and it's easy to do so for btree's own iterators. Also, exploit from in the examples.

@rust-highfive

Copy link
Copy Markdown
Contributor

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jun 8, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

r? @joshtriplett

(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 Jun 8, 2022
@the8472

the8472 commented Jun 8, 2022

Copy link
Copy Markdown
Member

LGTM

@bors r+ rollup=never

@bors

bors commented Jun 8, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 49ccb75 has been approved by the8472

@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 Jun 8, 2022
@bors

bors commented Jun 9, 2022

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 49ccb75 with merge be16c61...

@bors

bors commented Jun 9, 2022

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: the8472
Pushing be16c61 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 9, 2022
@bors bors merged commit be16c61 into rust-lang:master Jun 9, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 9, 2022
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (be16c61): comparison url.

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regression found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
2.5% 2.5% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

Cycles

This benchmark run did not return any relevant results for this metric.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change

  2. number of relevant changes

@ssomers ssomers deleted the btree_from_sorted_iter branch June 11, 2022 09:39
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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants