Skip to content
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

traits: preallocate 2 Vecs of known initial size #69022

Merged
merged 1 commit into from Feb 11, 2020

Conversation

@ljedrz
Copy link
Contributor

ljedrz commented Feb 10, 2020

The 2 preallocations are pretty obvious; both vectors will be as big as or larger than the collections they are created from.

In WfPredicates::normalize the change from a functional style improves readability and should be perf-friendly, too.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 10, 2020

r? @petrochenkov

(rust_highfive has picked a reviewer for you, use r? to override)

@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Feb 10, 2020

@bors r+ rollup

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 11, 2020

📌 Commit b8893df has been approved by petrochenkov

jonas-schievink added a commit to jonas-schievink/rust that referenced this pull request Feb 11, 2020
…enkov

traits: preallocate 2 Vecs of known initial size

The 2 preallocations are pretty obvious; both vectors will be as big as or larger than the collections they are created from.

In `WfPredicates::normalize` the change from a functional style improves readability and should be perf-friendly, too.
bors added a commit that referenced this pull request Feb 11, 2020
Rollup of 11 pull requests

Successful merges:

 - #68679 (Improve `ty.needs_drop`)
 - #68848 (Hasten macro parsing)
 - #68947 (Python script PEP8 style guide space formatting and minor Python source cleanup)
 - #69002 (miri: improve and simplify overflow detection)
 - #69022 (traits: preallocate 2 Vecs of known initial size)
 - #69026 (Remove common usage pattern from `AllocRef`)
 - #69027 (Add missing `_zeroed` varants to `AllocRef`)
 - #69031 (Use `dyn Trait` more in tests)
 - #69032 (ICE in nightly-2020-02-08: handle TerminatorKind::Yield in librustc_mir::transform::promote_consts::Validator method)
 - #69034 (parser: Remove `Parser::prev_token_kind`)
 - #69047 (Don't rustfmt check the vendor directory.)

Failed merges:

r? @ghost
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Feb 11, 2020
…enkov

traits: preallocate 2 Vecs of known initial size

The 2 preallocations are pretty obvious; both vectors will be as big as or larger than the collections they are created from.

In `WfPredicates::normalize` the change from a functional style improves readability and should be perf-friendly, too.
bors added a commit that referenced this pull request Feb 11, 2020
Rollup of 8 pull requests

Successful merges:

 - #66498 (Remove unused feature gates)
 - #68816 (Tweak borrow error on `FnMut` when `Fn` is expected)
 - #68824 (Enable Control Flow Guard in rustbuild)
 - #69022 (traits: preallocate 2 Vecs of known initial size)
 - #69031 (Use `dyn Trait` more in tests)
 - #69044 (Don't run coherence twice for future-compat lints)
 - #69047 (Don't rustfmt check the vendor directory.)
 - #69055 (Clean up E0307 explanation)

Failed merges:

r? @ghost
@bors bors merged commit b8893df into rust-lang:master Feb 11, 2020
4 checks passed
4 checks passed
pr Build #20200210.22 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@ljedrz ljedrz deleted the ljedrz:traits_tweak_vecs branch Feb 11, 2020
@jonas-schievink

This comment has been minimized.

Copy link
Member

jonas-schievink commented Feb 12, 2020

This got rolled up with #69044, but I think it has made a really big improvement, nice job! https://perf.rust-lang.org/compare.html?start=b6690a8c35e9afa3e0f65140cc69d4ba1b9e78c4&end=3f32e3001e3a64c1baa509d3d1734dff53f14d81&stat=instructions:u

(I expect #69044 to only improve packed-simd)

@ljedrz

This comment has been minimized.

Copy link
Contributor Author

ljedrz commented Feb 12, 2020

Aww yiss, thanks for letting me know 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.