Skip to content

Make Iterator::unzip fast#72159

Closed
leo60228 wants to merge 1 commit intorust-lang:masterfrom
leo60228:faster-unzip
Closed

Make Iterator::unzip fast#72159
leo60228 wants to merge 1 commit intorust-lang:masterfrom
leo60228:faster-unzip

Conversation

@leo60228
Copy link
Copy Markdown
Contributor

Closes #72085

This consists of the following optimizations:

  • Adds a with_capacity function to Extend. This definitely needs more thought if it's going to be stabilized, so I'm not writing an RFC yet. This takes off most of the performance gap.
  • Optimizes Vec's Extend implementation for the case where size_hint is 1. This shaves off the remaining performance gap.

Here's a fancy graph of the improvement:
image

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Iterator::unzip not zero cost

4 participants