Skip to content

VecDeque: improve performance for From<[T; N]> #88452

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

xu-cheng
Copy link
Contributor

@xu-cheng xu-cheng commented Aug 29, 2021

Create VecDeque directly from the array instead of inserting items one-by-one.

Benchmark

./x.py bench library/alloc --test-args vec_deque::bench_from_array_1000
  • Before
test vec_deque::bench_from_array_1000                    ... bench:       3,991 ns/iter (+/- 717)
  • After
test vec_deque::bench_from_array_1000                    ... bench:         268 ns/iter (+/- 37)

@rust-highfive
Copy link
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 Aug 29, 2021
Create VecDeque directly from the array instead of inserting items one-by-one.
@xu-cheng xu-cheng force-pushed the vecdeque-from-array branch from 0534638 to c3cff0a Compare August 29, 2021 04:10
@joshtriplett
Copy link
Member

r? @m-ou-se

This will probably conflict with #88611 .

@rust-highfive rust-highfive assigned m-ou-se and unassigned joshtriplett Sep 4, 2021
@the8472 the8472 added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 8, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 27, 2021
@m-ou-se
Copy link
Member

m-ou-se commented Oct 3, 2021

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 3, 2021

📌 Commit c3cff0a has been approved by m-ou-se

@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 Oct 3, 2021
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 4, 2021
…u-se

VecDeque: improve performance for From<[T; N]>

Create `VecDeque` directly from the array instead of inserting items one-by-one.

Benchmark
```
./x.py bench library/alloc --test-args vec_deque::bench_from_array_1000
```

* Before
```
test vec_deque::bench_from_array_1000                    ... bench:       3,991 ns/iter (+/- 717)
```

* After
```
test vec_deque::bench_from_array_1000                    ... bench:         268 ns/iter (+/- 37)
```
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 4, 2021
…u-se

VecDeque: improve performance for From<[T; N]>

Create `VecDeque` directly from the array instead of inserting items one-by-one.

Benchmark
```
./x.py bench library/alloc --test-args vec_deque::bench_from_array_1000
```

* Before
```
test vec_deque::bench_from_array_1000                    ... bench:       3,991 ns/iter (+/- 717)
```

* After
```
test vec_deque::bench_from_array_1000                    ... bench:         268 ns/iter (+/- 37)
```
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 4, 2021
…ingjubilee

Rollup of 13 pull requests

Successful merges:

 - rust-lang#83655 ([aarch64] add target feature outline-atomics)
 - rust-lang#87091 (implement advance_(back_)_by on more iterators)
 - rust-lang#88451 (Fix an ICE caused by type mismatch errors being ignored)
 - rust-lang#88452 (VecDeque: improve performance for From<[T; N]>)
 - rust-lang#89400 (Improve wording of `map_or_else` docs)
 - rust-lang#89407 (Recommend running `cargo clean` in E0514 output)
 - rust-lang#89443 (Include the length in BTree hashes)
 - rust-lang#89444 (rustdoc: use slice::contains instead of open-coding it)
 - rust-lang#89447 (Improve error message for missing angle brackets in `[_]::method`)
 - rust-lang#89453 (Consistently use 'supertrait'.)
 - rust-lang#89483 (Practice diagnostic message convention)
 - rust-lang#89500 (Fix ICE with buffered lint referring to AST node deleted by everybody_loops)
 - rust-lang#89508 (Stabilize `const_panic`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 19d9a14 into rust-lang:master Oct 4, 2021
@rustbot rustbot added this to the 1.57.0 milestone Oct 4, 2021
@xu-cheng xu-cheng deleted the vecdeque-from-array branch October 4, 2021 23:46
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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.

8 participants