diff --git a/.travis.yml b/.travis.yml index b73c7a2..ee8844e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: rust rust: - stable - beta - - nightly script: @@ -18,6 +17,14 @@ matrix: - name: "Check style" language: generic script: ./ci/check-basic-style.sh + - name: "Nightly (with benchmarks)" + language: rust + rust: nightly + script: + - cargo build || travis_terminate 1 + - cargo build --benches --features=nightly-bench || travis_terminate 1 + - cargo test || travis_terminate 1 + - cargo doc || travis_terminate 1 - name: "Miri tests (nightly)" language: rust rust: nightly diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e3149f..42bb3a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] + +## [0.4.0] - 2019-08-26 This is a pretty large release. The whole crate was more or less completely rewritten. So it might almost be more useful to forget everything about the crate and learn everything anew instead of digging through this changelog. @@ -142,7 +144,8 @@ crate and learn everything anew instead of digging through this changelog. - Everything. -[Unreleased]: https://github.com/LukasKalbertodt/stable-vec/compare/v0.3.2...HEAD +[Unreleased]: https://github.com/LukasKalbertodt/stable-vec/compare/v0.4.0...HEAD +[0.3.2]: https://github.com/LukasKalbertodt/stable-vec/compare/v0.3.2...v0.4.0 [0.3.2]: https://github.com/LukasKalbertodt/stable-vec/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/LukasKalbertodt/stable-vec/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/LukasKalbertodt/stable-vec/compare/v0.2.2...v0.3.0 diff --git a/Cargo.toml b/Cargo.toml index 263aefc..dc39201 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,18 +1,19 @@ [package] name = "stable-vec" -version = "0.4.0-beta" +version = "0.4.0" authors = ["Lukas Kalbertodt "] edition = "2018" description = """ -A Vec-like collection which guarantees stable indices and features -O(1) deletion of elements (semantically similar to `Vec>`) +A Vec-like collection which guarantees stable indices and features O(1) +element deletion (semantically similar to `Vec>`). Useful for +allocations in graphs or similar data structures. """ documentation = "https://docs.rs/stable-vec" repository = "https://github.com/LukasKalbertodt/stable-vec" license = "MIT/Apache-2.0" -keywords = ["stable", "vec", "vector", "index", "option"] -categories = ["data-structures", "no-std"] +keywords = ["vector", "index", "option", "arena", "bitvec"] +categories = ["data-structures", "memory-management", "no-std"] readme = "README.md" [badges] diff --git a/benches/benchmark.rs b/benches/benchmark.rs index c056d22..e4b6b5f 100644 --- a/benches/benchmark.rs +++ b/benches/benchmark.rs @@ -259,7 +259,7 @@ fn sum(c: &mut Criterion) { "sum_full", move |b, &len| { let sv = full_sv(len); - b.iter(|| sv.iter().map(|&e| e as u64).sum::()); + b.iter(|| sv.values().map(|&e| e as u64).sum::()); }, vec![0, 1, 10, 1000, 100_000], ); @@ -268,7 +268,7 @@ fn sum(c: &mut Criterion) { "sum_with_one_hole", move |b, &len| { let sv = sv_with_hole_in_middle(len); - b.iter(|| sv.iter().map(|&e| e as u64).sum::()); + b.iter(|| sv.values().map(|&e| e as u64).sum::()); }, vec![10, 1000, 100_000], ); @@ -277,7 +277,7 @@ fn sum(c: &mut Criterion) { "sum_with_hole_every_fifth", move |b, &len| { let sv = sv_with_hole_every_fifth(len); - b.iter(|| sv.iter().map(|&e| e as u64).sum::()); + b.iter(|| sv.values().map(|&e| e as u64).sum::()); }, vec![10, 1000, 100_000], ); @@ -286,7 +286,7 @@ fn sum(c: &mut Criterion) { "sum_with_element_every_fifth", move |b, &len| { let sv = sv_with_element_every_fifth(len); - b.iter(|| sv.iter().map(|&e| e as u64).sum::()); + b.iter(|| sv.values().map(|&e| e as u64).sum::()); }, vec![10, 1000, 100_000], ); @@ -295,7 +295,7 @@ fn sum(c: &mut Criterion) { "sum_with_prime_holes", move |b, &len| { let sv = sv_with_prime_holes(len); - b.iter(|| sv.iter().map(|&e| e as u64).sum::()); + b.iter(|| sv.values().map(|&e| e as u64).sum::()); }, vec![10, 1000, 100_000], ); @@ -304,7 +304,7 @@ fn sum(c: &mut Criterion) { "sum_two_elements", move |b, &len| { let sv = two_element_sv(len); - b.iter(|| sv.iter().map(|&e| e as u64).sum::()); + b.iter(|| sv.values().map(|&e| e as u64).sum::()); }, vec![10, 1000, 100_000], ); @@ -313,7 +313,7 @@ fn sum(c: &mut Criterion) { "sum_fully_deleted", move |b, &len| { let sv = fully_deleted_sv(len); - b.iter(|| sv.iter().map(|&e| e as u64).sum::()); + b.iter(|| sv.values().map(|&e| e as u64).sum::()); }, vec![10, 1000, 100_000], ); diff --git a/src/lib.rs b/src/lib.rs index cd8e492..d32b7ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,8 +38,8 @@ //! //! # How? //! -//! Actually, the implementation of this stable vector is rather simple. We can -//! trade O(1) deletions and stable indices for a higher memory consumption. +//! We can trade O(1) deletions and stable indices for a higher memory +//! consumption. //! //! When `StableVec::remove()` is called, the element is just marked as //! "deleted" (and the actual element is dropped), but other than that, nothing @@ -199,7 +199,7 @@ pub type ExternStableVec = StableVecFacade>; /// /// # Implemented traits /// -/// This type implement a couple of traits. Some of those implementations +/// This type implements a couple of traits. Some of those implementations /// require further explanation: /// /// - `Clone`: the cloned instance is exactly the same as the original,