Skip to content

Don't collect() when size_hint is useless #53019

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 1 commit into from
Aug 13, 2018
Merged

Conversation

ljedrz
Copy link
Contributor

@ljedrz ljedrz commented Aug 3, 2018

This adjusts PRs #52738 and #52697 by falling back to calculating capacity and extending or pushing in a loop where collect() can't be trusted to calculate the right capacity.

It is a performance win.

@rust-highfive
Copy link
Contributor

r? @estebank

(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 3, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Aug 3, 2018

Why is the collect not computing the right capacity? Can we fix the iterators instead?

@ljedrz
Copy link
Contributor Author

ljedrz commented Aug 3, 2018

@oli-obk I tried

@estebank
Copy link
Contributor

estebank commented Aug 8, 2018

@bors try

@Mark-Simulacrum perf?

@bors
Copy link
Collaborator

bors commented Aug 8, 2018

⌛ Trying commit b68b396 with merge 8e2e6c66ea86427aaa922f7b5e6eea92cc4f9a51...

@bors
Copy link
Collaborator

bors commented Aug 8, 2018

☀️ Test successful - status-travis
State: approved= try=True

@Mark-Simulacrum
Copy link
Member

@rust-timer build 8e2e6c66ea86427aaa922f7b5e6eea92cc4f9a51

@rust-timer
Copy link
Collaborator

Success: Queued 8e2e6c66ea86427aaa922f7b5e6eea92cc4f9a51 with parent 3f4f18f, comparison URL.

@estebank
Copy link
Contributor

estebank commented Aug 9, 2018

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 9, 2018

📌 Commit b68b396 has been approved by estebank

@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 Aug 9, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Aug 10, 2018
Don't collect() when size_hint is useless

This adjusts PRs rust-lang#52738 and rust-lang#52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity.

It is a performance win.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 12, 2018
Don't collect() when size_hint is useless

This adjusts PRs rust-lang#52738 and rust-lang#52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity.

It is a performance win.
bors added a commit that referenced this pull request Aug 12, 2018
Rollup of 15 pull requests

Successful merges:

 - #52955 (Update compiler test documentation)
 - #53019 (Don't collect() when size_hint is useless)
 - #53025 (Consider changing assert! to debug_assert! when it calls visit_with)
 - #53059 (Remove explicit returns where unnecessary)
 - #53165 ( Add aarch64-unknown-netbsd target)
 - #53210 (Deny future duplication of rustc-ap-syntax)
 - #53223 (A few cleanups for rustc_data_structures)
 - #53230 ([nll] enable feature(nll) on various crates for bootstrap: part 4)
 - #53231 (Add let keyword doc)
 - #53240 (Add individual documentation for <integer>`.swap_bytes`/.`reverse_bits`)
 - #53253 (Remove unwanted console log)
 - #53264 (Show that Command can be reused and remodified)
 - #53267 (Fix styles)
 - #53273 (Add links to std::char::REPLACEMENT_CHARACTER from docs.)
 - #53283 (wherein we suggest float for integer literals where a float was expected)

Failed merges:

r? @ghost
@bors bors merged commit b68b396 into rust-lang:master Aug 13, 2018
@ljedrz ljedrz deleted the bad_collects branch August 13, 2018 05:38
# 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants