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

First specialization #123

Merged
merged 1 commit into from Aug 30, 2018
Merged

First specialization #123

merged 1 commit into from Aug 30, 2018

Conversation

llogiq
Copy link
Contributor

@llogiq llogiq commented Aug 27, 2018

I added a new specialization feature that will specialize From<&[_: Copy]> to use from_slice, which offers a nice performance boost.

Alas, I could not get any measurable perf improvement on insert_many or extend yet, so I'll leave them out for now.


This change is Reviewable

lib.rs Outdated

#[cfg(feature = "specialization")]
#[inline]
default fn from(slice: &'a [A::Item]) -> SmallVec<A> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't that mean that one can specialise the implementation from outside the crate? Shouldn't we be specialising an internal trait used by this impl?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add an internal SpecFrom trait then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

I added a new `specialization` feature that will specialize
`From<&[_: Copy]>` to use `from_slice`, which offers a nice
performance boost.

Alas, I could not get any measurable perf improvement on
`insert_many` or `extend`, so I'll leave them out for now.
@llogiq
Copy link
Contributor Author

llogiq commented Aug 30, 2018

This should now be ready for merging.

@nox
Copy link
Contributor

nox commented Aug 30, 2018

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 49c43d0 has been approved by nox

@bors-servo
Copy link
Contributor

⌛ Testing commit 49c43d0 with merge ee5fe38...

bors-servo pushed a commit that referenced this pull request Aug 30, 2018
First specialization

I added a new `specialization` feature that will specialize `From<&[_: Copy]>` to use `from_slice`, which offers a nice performance boost.

Alas, I could not get any measurable perf improvement on `insert_many` or `extend` yet, so I'll leave them out for now.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/123)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis
Approved by: nox
Pushing ee5fe38 to master...

@bors-servo bors-servo merged commit 49c43d0 into servo:master Aug 30, 2018
@llogiq llogiq deleted the specialization branch August 30, 2018 10:41
mbrubeck added a commit to mbrubeck/rust-smallvec that referenced this pull request Nov 15, 2018
Changes in this release:

* Fix possible over-allocation in `from_slice` (servo#122)
* Optional nightly-only `specialization` feature for `from_slice`
  optimization (servo#123)
* New `from_raw_parts` constructor (servo#130)
* Documentation and testing improvements (servo#125, servo#129)
@mbrubeck mbrubeck mentioned this pull request Nov 15, 2018
bors-servo pushed a commit that referenced this pull request Nov 16, 2018
Version 0.6.6

Changes in this release:

* Fix possible over-allocation in `from_slice` (#122)
* Optional nightly-only `specialization` feature for `from_slice` optimization (#123)
* New `from_raw_parts` constructor (#130)
* Documentation and testing improvements (#125, #129)

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/131)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants