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

Conversation

Projects
None yet
4 participants
@bluss
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Dec 5, 2016

Collaborator

r? @alexcrichton

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

Collaborator

rust-highfive commented Dec 5, 2016

r? @alexcrichton

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

@bluss

This comment has been minimized.

Show comment
Hide comment
@bluss

bluss Dec 5, 2016

Contributor

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

Contributor

bluss commented Dec 5, 2016

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

vec: More specialization for Extend<&T> for vec
Specialize to use copy_from_slice when extending a Vec with &[T] where
T: Copy.
@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Dec 6, 2016

Member

@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

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

This comment has been minimized.

Show comment
Hide comment
@bors

bors Dec 6, 2016

Contributor

📌 Commit 02bf1ce has been approved by alexcrichton

Contributor

bors commented Dec 6, 2016

📌 Commit 02bf1ce has been approved by alexcrichton

@bluss

This comment has been minimized.

Show comment
Hide comment
@bluss

bluss Dec 6, 2016

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@bluss

bluss Dec 7, 2016

Contributor

@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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@bors

bors Dec 8, 2016

Contributor

⌛️ Testing commit 02bf1ce with merge 7537f95...

Contributor

bors commented Dec 8, 2016

⌛️ Testing commit 02bf1ce with merge 7537f95...

bors added a commit that referenced this pull request Dec 8, 2016

Auto merge of #38182 - bluss:more-vec-extend, r=alexcrichton
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

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

@bluss bluss referenced this pull request Jan 5, 2017

Merged

Copy clone semantics #1521

@Dr-Emann Dr-Emann referenced this pull request Feb 4, 2017

Open

Use csv's zero-copy API #3

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