From 6cdd6a48995d0fa8c32567ed0f088361119c1485 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Mon, 26 Aug 2019 15:18:52 +0200 Subject: [PATCH 1/4] Improve metadata and fix some docs --- Cargo.toml | 9 +++++---- src/lib.rs | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 263aefc..93a323c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,14 +5,15 @@ 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/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, From 94002c49a736feca7d20f8ca684d58e7e21f5ee4 Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Mon, 26 Aug 2019 15:19:30 +0200 Subject: [PATCH 2/4] Bump version to 0.4.0 --- CHANGELOG.md | 5 ++++- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) 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 93a323c..dc39201 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stable-vec" -version = "0.4.0-beta" +version = "0.4.0" authors = ["Lukas Kalbertodt "] edition = "2018" From 814ffd559717a32d1ea07575c599607a2478420a Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Mon, 26 Aug 2019 15:34:19 +0200 Subject: [PATCH 3/4] Update benchmarks --- benches/benchmark.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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], ); From 4040cce3a4d0de17dcc0b238829e13208a9029ff Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Mon, 26 Aug 2019 15:34:42 +0200 Subject: [PATCH 4/4] Improve TravisCI config by building benchmarks --- .travis.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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