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

Allow smallvec! with non-Copy items #107

Merged
merged 1 commit into from Aug 4, 2018
Merged

Conversation

@RReverser
Copy link
Contributor

RReverser commented Jul 27, 2018

When count of items is smaller or equal than the target inline size, macro will use SmallVec::push, but when it's large enough, it passes data on to vec! macro for in-place heap allocation and then uses SmallVec::from_vec.

This trick gives ~3.5x performance increase on bench_macro_from_list compared to SmallVec::with_capacity.

Fixes #98.


This change is Reviewable

When count of items is smaller or equal than the target inline size, macro will use `SmallVec::push`, but when it's large enough, it passes data on to `vec!` macro for in-place heap allocation and then uses `SmallVec::from_vec`.

This trick gives ~3.5x performance increase on `bench_macro_from_list` compared to `SmallVec::with_capacity`.

Fixes #98.
@mbrubeck
Copy link
Contributor

mbrubeck commented Aug 4, 2018

@bors-servo r+

Thanks!

@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2018

📌 Commit fb32eb2 has been approved by mbrubeck

@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2018

Testing commit fb32eb2 with merge 6384430...

bors-servo added a commit that referenced this pull request Aug 4, 2018
Allow smallvec! with non-Copy items

When count of items is smaller or equal than the target inline size, macro will use `SmallVec::push`, but when it's large enough, it passes data on to `vec!` macro for in-place heap allocation and then uses `SmallVec::from_vec`.

This trick gives ~3.5x performance increase on `bench_macro_from_list` compared to `SmallVec::with_capacity`.

Fixes #98.

<!-- 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/107)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2018

💔 Test failed - status-travis

@mbrubeck
Copy link
Contributor

mbrubeck commented Aug 4, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2018

Testing commit fb32eb2 with merge 994ecc7...

bors-servo added a commit that referenced this pull request Aug 4, 2018
Allow smallvec! with non-Copy items

When count of items is smaller or equal than the target inline size, macro will use `SmallVec::push`, but when it's large enough, it passes data on to `vec!` macro for in-place heap allocation and then uses `SmallVec::from_vec`.

This trick gives ~3.5x performance increase on `bench_macro_from_list` compared to `SmallVec::with_capacity`.

Fixes #98.

<!-- 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/107)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2018

💔 Test failed - status-travis

@mbrubeck
Copy link
Contributor

mbrubeck commented Aug 4, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2018

Testing commit fb32eb2 with merge a56ed6e...

bors-servo added a commit that referenced this pull request Aug 4, 2018
Allow smallvec! with non-Copy items

When count of items is smaller or equal than the target inline size, macro will use `SmallVec::push`, but when it's large enough, it passes data on to `vec!` macro for in-place heap allocation and then uses `SmallVec::from_vec`.

This trick gives ~3.5x performance increase on `bench_macro_from_list` compared to `SmallVec::with_capacity`.

Fixes #98.

<!-- 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/107)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2018

☀️ Test successful - status-travis
Approved by: mbrubeck
Pushing a56ed6e to master...

@bors-servo bors-servo merged commit fb32eb2 into servo:master Aug 4, 2018
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
mbrubeck added a commit to mbrubeck/rust-smallvec that referenced this pull request Aug 6, 2018
Change log:

* Extend the `smallvec!` macro to work with non-`Copy` items (servo#107)
* Improve the `Debug` formatting implementation (servo#109)
@mbrubeck mbrubeck mentioned this pull request Aug 6, 2018
bors-servo added a commit that referenced this pull request Aug 6, 2018
Version 0.6.4

Change log:

* Extend the `smallvec!` macro to work with non-`Copy` items (#107)
* Improve the `Debug` formatting implementation (#109)

<!-- 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/110)
<!-- Reviewable:end -->
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

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