Skip to content

[WIP] Use a union to reduce the size of SmallVec #92

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ rust:
- stable
script: |
cargo build --verbose &&
cargo build --all-features --verbose &&
cargo test --verbose &&
cargo test --all-features --verbose &&
([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --no-default-features) &&
([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --features union) &&
([ $TRAVIS_RUST_VERSION != nightly ] || cargo bench --verbose bench)
notifications:
webhooks: http://build.servo.org:54856/travis
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ documentation = "http://doc.servo.org/smallvec/"

[features]
std = []
union = []
default = ["std"]

[lib]
Expand Down
9 changes: 6 additions & 3 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
extern crate smallvec;
extern crate test;

use smallvec::SmallVec;
use self::test::Bencher;
use smallvec::SmallVec;

#[bench]
fn bench_push(b: &mut Bencher) {
Expand Down Expand Up @@ -42,8 +42,11 @@ fn bench_insert(b: &mut Bencher) {
#[bench]
fn bench_insert_many(b: &mut Bencher) {
#[inline(never)]
fn insert_many_noinline<I: IntoIterator<Item=u64>>(
vec: &mut SmallVec<[u64; 16]>, index: usize, iterable: I) {
fn insert_many_noinline<I: IntoIterator<Item = u64>>(
vec: &mut SmallVec<[u64; 16]>,
index: usize,
iterable: I,
) {
vec.insert_many(index, iterable)
}

Expand Down
Loading