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

Specialization for Extend<&T> for vec #38182

Merged
merged 1 commit into from Dec 8, 2016
Merged

Conversation

@bluss
Copy link
Member

bluss commented Dec 5, 2016

Specialize to use copy_from_slice when extending a Vec with &[T] where
T: Copy.

This specialization results in .clone() not being called in extend_from_slice and extend when the element is Copy.

Fixes #38021

@rust-highfive
Copy link
Collaborator

rust-highfive commented Dec 5, 2016

r? @alexcrichton

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

@bluss
Copy link
Member Author

bluss commented Dec 5, 2016

r? @alexcrichton This fix goes forward instead of backwards, you could say, by adding more specializations instead of reverting.

Specialize to use copy_from_slice when extending a Vec with &[T] where
T: Copy.
@bluss bluss force-pushed the bluss:more-vec-extend branch from 41b55da to 02bf1ce Dec 6, 2016
@alexcrichton
Copy link
Member

alexcrichton commented Dec 6, 2016

@bors: r+

Seems ok to me, thanks!

I'd still ideally prefer to explore the route of adding codegen tests eventually (to ensure we don't regress) but that can happen in a follow-up

@bors
Copy link
Contributor

bors commented Dec 6, 2016

📌 Commit 02bf1ce has been approved by alexcrichton

@bluss
Copy link
Member Author

bluss commented Dec 6, 2016

Ok, there is no codegen test, but codegen for extend_with_slice was examined and was fine before it went in, so in that way it's unlikely that it would have been caught that way. It already optimized fine in many situations.

@bluss
Copy link
Member Author

bluss commented Dec 7, 2016

@dtolnay This PR fixes the regression in the sense that the regression I saw here #38021 (comment) was verified to be back at its old performance at 1.5-1.6 ms/iter. I haven't done further tests.

@bors
Copy link
Contributor

bors commented Dec 8, 2016

Testing commit 02bf1ce with merge 7537f95...

bors added a commit that referenced this pull request Dec 8, 2016
Specialization for Extend<&T> for vec

Specialize to use copy_from_slice when extending a Vec with &[T] where
T: Copy.

This specialization results in `.clone()` not being called in `extend_from_slice` and `extend` when the element is `Copy`.

Fixes #38021
@bors bors merged commit 02bf1ce into rust-lang:master Dec 8, 2016
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@bluss bluss deleted the bluss:more-vec-extend branch Dec 8, 2016
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

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